First i'll just show a segment of the code Code: int main() { loop();//start the loop checking for keys return 0; } void unhook() { UnhookWindowsHookEx(unhk); } int hook() { int argc; char **argv; HANDLE hThread; DWORD dwThread; hThread = CreateThread(NULL,NULL,(LPTHREAD_START_ROUTINE) TheKeyLogger, (LPVOID) argv[0], NULL, &dwThread); hkd=TRUE;//set variable hkd to true if (hThread) return WaitForSingleObject(hThread,INFINITE); else return 1; } void loop() { if (GetAsyncKeyState(VK_F5) && hkd==FALSE) { hook(); } else if (GetAsyncKeyState(VK_F5) && hkd==TRUE) { unhook(); } } it's a port of a vb.net program i wrote, in my vb program i call between subs (subs are hook, and unhook) but when i do this in c++ i get various errors in vb.net i would do this Code: public sub hook() 'hooks stuff End Sub Public sub Loop() call hook() end sub how do i do this in c++ (im also confused on when to use int,or void, i've learned c++ in about 2 days so give me a break)
I'm not sure what exactly you are trying to achieve, but maybe you should go read some C++ tutorials. In C++, it matters in which order functions are placed in a .cpp file (unlike VB.NET) because it reads the code from top to bottom. You should place main at the bottom because it depends on hook and unhook.
i was just playing around with c++, i'm not seriously involved in it i'm just learning by experience, like how i did with vb.net