View Full Version : Code Assistance
Ron
October 13th, 2002, 12:55 PM
You can't hardcode the 0, you must use a number returned by Girder. (showTreepicker)
Mark F
October 13th, 2002, 12:55 PM
Do you really have the 0 hardcoded in GetLinkName(0)? Or was this value returned from TreePickerShow?
I'm just guessing but I think the GetLinkName interface assumes you are passing something retrieved from TreePickerShow and 0 is invalid.
JayGuerette
October 13th, 2002, 12:55 PM
I'm trying to access Girder support functions inside a hardware plugin. Here's the pertinent snippets of code:
<girder.h>
typedef struct s_TFunctionsEx2 { /* Version 2 */
DWORD dwSize;
PSetGirderReg SetGirderReg;
PGetGirderReg GetGirderReg;
PParseRegString ParseRegString;
PGetLinkName GetLinkName;
PSetCommand SetCommand;
PTargetEnum TargetEnum;
PI18NTranslate I18NTranslate;
PReallocPCHAR ReallocPchar;
PShowOSD ShowOSD;
PHideOSD HideOSD;
PStartOSDDraw StartOSDDraw;
PStopOSDDraw StopOSDDraw;
PTreePickerShow TreePickerShow;
HWND TargetHWND;
} TFunctionsEx2;
TFunctionsEx2 Girder;
extern TFunctionsEx2 Girder;
<girder.cpp>
__declspec(dllexport) int h_support_functions(void *s)
{
TFunctionsEx2 *p;
if (s==NULL) {
return 2; // version 2 hardware support functions
}
else
{
p=(TFunctionsEx2 *)s;
if (p->dwSize!=sizeof(TFunctionsEx2)) {
return GIR_ERROR;
}
memcpy((void *)&Girder, s, sizeof(TFunctionsEx2));
}
return 0;
}
char *buf;
MessageBox(0, "here comes a crash", "Error",0);
buf=(PCHAR)Girder.GetLinkName(0);
MessageBox(0, buf, "Error",0);
The header file has all the other standard girder.h stuff in it, I just snipped the important stuff.
All this code lives inside a current living and breathing hardware plugin that works fine. I just added this code to try it.
When I hit the "buf=(PCHAR)Girder.GetLinkName(0);" line, I get a fatal error and Girder crashes.
Any ideas on what am I doing wrong?
<font size=-1>[ This Message was edited by: JayGuerette on 2001-07-29 07:37 ]</font>
<font size=-1>[ This Message was edited by: JayGuerette on 2001-07-29 07:38 ]</font>
JayGuerette
October 13th, 2002, 12:55 PM
Yes, I hard coded the 0. I assumed (incorrectly?) that the TreePicker values would merely be an index starting at 0...?
JayGuerette
October 13th, 2002, 12:55 PM
I was trying to cheat... enumerating the commands through the API without displaying the Tree window.
Powered by vBulletin® Version 4.1.8 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.