LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Find a procedure address

I want execute a function by its name: I want used EnumResTypeProc and EnumResNameProc, but
this function Microsoft is not know in windows.h of SDK (LabWindows 6.00).
So do you know the method used by CVI in the uir file, to call a function.
Exemple:

#include

void toto(void)
{
printf("OK\n");
}
int main (int argc, char *argv[])
{
HANDLE hExe; // handle to existing .EXE file

hExe = GetCurrentProcess();
if (hExe == NULL) return 0;

//EnumResTypeProc and EnumResNameProc unknow !!!
How_to_call(hExe ,"toto");
}
0 Kudos
Message 1 of 4
(3,171 Views)
I'm confused as to what you are trying to do. First off, the functions you are referring to (EnumResNameProc, etc.) are not for functions, they are for finding resources. Resources are things like bitmaps, cursors, icons, etc. So the functions you are referring to would not seem to apply to what you are doing. You can call them from CVI Full version though.

It is unclear what you are trying to do. If you are trying to call a function defined in the current process, you just have to call the function by name since it is a defined symbol in the process. So you would replace the line:

How_to_call(hExe ,"toto");

with

toto();

That would call the function. If you are trying to call the function from another EXE, you can't do that. You can ca
ll functions from DLLs that are exported with LoadLibrary and GetProcAddress. To do what it sounds like you want, you would just have:

void toto(void)
{
printf("OK\n");
}
int main (int argc, char *argv[])
{
toto();
}

Hope that helps,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 4
(3,171 Views)
It is possible, because I work on a program tester which do this.
I write many test functions, and generate the executable.
This executable open a data base (Test description) and can call my test functions.
But the engine of this tester is a static lib and I cannot found the code of the writer, because the firm in Belgium is closed.

So, I know, LoadLibrary and GetProcAddress are used for dll, and this call method must be in the unique EXE.
If you edit an executable, you can see your function names.

I think that CVI use the same method:
If you edit an uir file and change a label of a function by an another ("toto" for example), when you execute your program and click on concerned button, "toto" function is called.

Best regards.
Nicolas.
0 Kudos
Message 3 of 4
(3,171 Views)
You can call function in a LIB or OBJ from CVI. We have a function called LoadExternalModule that can be used for this. There are some examples that use this function that you can look at. You can't call functions from an EXE though. DLLs and EXEs are already compiled and linked. The DLLs are equipped to export functions which allows them to be called outside the DLL. EXEs do not export functions, so you can't call them. LoadExternalModule is a unique feature of CVI that allows you to load compile LIB and OBJ files at link them at run-time.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 4 of 4
(3,171 Views)