hi guys. i am trying to use pointers to functions in my dll to call a function in my .exe i am storing my pointer in a global variable, so it can be called by any function. the trouble is, i am finding that it can be only called by my addeventCallback function i.e. Code: #include "dll.h" EVENTCALLBACK evtcb = NULL; BOOL WINAPI AddEventCallback(EVENTCALLBACK ptr) { evtcb = ptr; evtcb("pass on the message!"); evtcb("pass on the message!"); } LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam) { if(nCode < 0) return CallNextHookEx(0, nCode, wParam, lParam); evtcb("pass on the message!"); this displays "pass on the message" twicein the console, but when i try to cal evtcb() from GetMsgProc, it does not show again, meaning it has failed somewhere. i know my GetMsgProc is fine as i have used other indicators such as MessageBepp(0) to show it is working. what is the problem here? cheers. -- modified at 8:50 Thursday 8th September, 2005
dave2k
Posts
-
function pointers and dlls -
memcmp & bitmapsi am trying to find an instance of a small bitmap in a screen grab of a window. so far i have managed to load both bitmaps into two BYTE arrays. I found some code which searches through the bitmaps and uses memcmp to see if the smaller one is present in the larger. the trouble is, i am having trouble with the memcmp function: memcmp(ScreenBmp[i][tmpY],CardBmp[x], card_line_length ) What should ScreenBmp and CardBmp represent. I have the two bitmaps in BYTE buffer arrays, so how can i get them into the format above. The code i used to get them into these arrays is below: HANDLE hBitMap = LoadImage(0, "img.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); BITMAP bitmap; GetObject(hBitMap,sizeof(BITMAP),&bitmap); int size = bitmap.bmHeight*bitmap.bmWidth*bitmap.bmBitsPixel/8; /// cout << bitmap.bmHeight << endl; BYTE *lpBits = new BYTE[ size ]; GetBitmapBits((HBITMAP)hBitMap,size,lpBits ); //delete []lpBits; HANDLE hBitMap2 = LoadImage(0, "img2.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); BITMAP bitmap2; GetObject(hBitMap2,sizeof(BITMAP),&bitmap2); int size2 = bitmap2.bmHeight*bitmap2.bmWidth*bitmap2.bmBitsPixel/8; /// cout << bitmap.bmHeight << endl; BYTE *lpBits2 = new BYTE[ size2 ]; GetBitmapBits((HBITMAP)hBitMap2,size2,lpBits2 ); cheers!
-
load imagehow can i get a BYTE* from a bmp file? thankyou
-
LoadImage (newbie)someone created that structure for me. later on, each image will be passed into memcmp (memory compare), along with a gui bitmap, to see whether the bitmap exists. will this still work with HBITMAP?
-
LoadImage (newbie)I have the structrue [code] struct Card{ char szFileName[MAX_PATH]; BYTE *lpImage; Cards CardType; };[/code] an array of this structure will store 52 images representing different cards. at the begining of my program i need to load all the images, and this is my effort for loading an image: [code] HBITMAP hbm = LoadImage(0, (LPCTSTR)"img.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE);[/code] hbm is of type HBITMAP, so how can i get it into the structure where theimage type is of BYTE? cheers
-
Frailty of lifeOur thoughts are with you friend, David.
-
interacting with other programi guess my first thing todo is build a program with the same buttons as the casino program, so i can play the game without interacting with it's interface. so how do i do this? will i have to use win32 functions? could i use python (with com support)? specifically what functions will be required here? thanks.
-
interacting with other programso as i understand, there are 2 ways to do this: 1) read the tcp/ip packets and manipulate them this way 2) read the info comming from the program itself, and emulate the mouse and keyboard this way is this correct? surely the 2nd answer is the way, as i can imagine all sorts of security stuff is in place to prevent bots connected to their servers.
-
interacting with other programthe game is texas holdem, and i would program it so that it based odds depedning on what cards are out and how many othe rplayers there are etc, so i dont think it's completely luck
-
interacting with other programbtw when i say online, i don't mean a website, it's a desktop program which connects to the internet
-
interacting with other programthe game playing side is ok - as long as it's programmed correctly, a program should retrn alot more money thn a human could, and it would be running all day while i am at work! so how can i start researching what i need to do? what is this stream reading about? cheers
-
interacting with other programi would like to make a program which will play online poker for me! nevermind the game code, i am just wondering whether it would actually be possible to interact with one of these online poker programs.. i don't know much about desktop programming but i am willing to learn. I know for a fact that programs can get info from these poker programs, as i have seen one work. but what about actually inteacting? cheers
-
multi dimensional array in formi have a survey which involves multiple radiobuttons what i want to do is have a (multi dimensional?) array, so that each second dimension represnts a row of radiobuttons. The trouble is i don't know what to name the arrays as. Obviously for each row the names for the different radio buttons will be the same, meaning you can only select one. in php you could do it with a single array as you name each row of radio button differently: 1st row: name='array[0]' 2nd: name='array[1]' in asp it doesn't look like you can do it this way, because to create a similar array you'd do something like 1st row: name='array' 2nd name='array' then use split in the recipient script. This does not work however, because each radiobutton (on all rows) has the same name, and therefore when you click one all the rest on every row are unclicked.. thankyou
-
c++ .netwhat's this all about then? if all the .net languages compile down to the same intermediate language, i assume that a similar program written in c++ .net and lets say c# runs at the same speed? so then what is the point in using c++ with it's added complexities (admitedly not as comlpex as unmanagaed c++) to keep the older developers happy?
-
40 million credit cards exposedwell i have 5 (determined not to get a loan) :eek:
-
40 million credit cards exposedwell i have 5 :eek:
-
Indianapolis farce!For me, the blame lies with the FIA, Michellin & Berny Echlestone. Michellin is the obvious choice for not haveing tires ready. There are many factors for this including the new 'diamond cut' surface of the track etc. I heard yeterday that bridegstone had been able to prepare for this in dvance because they supply indy cars with their tyres a month before. It also seems like michelin only found out about the problem after ralf's tyre exploded in practice. However, when they did find out, they took all the appropriate steps, and told the FIA that a chicane was the only option. The FIA made in my opinion the fatal mistake by not including the chicane. I mean i know rules are rules, but this usually concerns individual teams, not the majority of the track. Bernie also told us that the race would go ahead when speaking on saturday. He lies, so owes me $1 billion of his fortune ;)
-
3d characteranyone else had experiences with .X files? thankyou.
-
3d characteryeh, i had a look at milkshape too (looks good). basically, i need to create a character which has, say 20 movemets, including facial expressions. i know i can create theswe animations in 3dsmax, but i am having trouble exporting. currently i am mucking around with opengl, and have found it's very difficult to get an animation working in opengl. i managed to create a .3ds reader, and can view basic models, but not animations. the animation i am using is probly going to be skeletal, but i am not sure. i was just wondering whether using directx would make life alot easier from the animation point of view.. and how to do it ofcourse! so my mission is to create a couple of animations first off, and be able to display them in my program using directx or opengl or whatever.. thankyou!
-
3d characterany idea how they accomplish this?