|
hi. tks for the reply.
hmm.. what i did was:
1. i paste the dll file in my debug folder of my VC++.NET application
2. i added the dll.h ( header file ) into my application.
3. i place the dll.lib in the debug folder as well.
4. go to my linker-> additional dependencies-> i included the path to the dll.h
so in my application, i want to use the dll function, eg. installhook()
it prompt me unresolved external symbol
" error LNK2019: unresolved external symbol __imp__installhook referenced in function "public: __thiscall CChildFrame::CChildFrame(void)" (??0CChildFrame@@QAE@XZ)"
in my dll.h, the code is as follows:
------------------------------
#ifdef KEYDLL3_EXPORTS
#define KEYDLL3_API __declspec(dllexport)
#else
#define KEYDLL3_API __declspec(dllimport)
#endif
KEYDLL3_API void installhook(HWND h);
KEYDLL3_API void removehook();
KEYDLL3_API LRESULT CALLBACK hookproc(int ncode,WPARAM wparam,LPARAM lparam);
----------------------------------
what steps did i missed? or the way i link my dll is wrong?
can help? tks.
rdgs, terr
|
|
|
|
|
Did include dll.lib file to linker-> additional dependencies
|
|
|
|
|
hi..
i did include the C:\dll.lib into the additional dependencies.
it prompt me the unresolved external symbol ( for the functions that i used. )
you know why?
is it because the dll was created using VC++6.0 and i use it in my VC++ .NET 2003 ?
is there any special codes that i need to add?
tks.
|
|
|
|
|
hi tks. i managed to solved the error.
I redo the whole steps again.
tks.
|
|
|
|
|
|
Hi,
I want to safe remove an usb drive programatically .So for that i have followed "Uwe_Sieber" article "How to prepare an USB drive for save removal" in code project .I am able to do it by running the application from another drive.Now i want to safe remove usb drive by running the application from the same drive as per our project requirement.When i tried this the usb drive is not removed.How can i achieve safe removal of usb drive by running the application from the same drive.
Thanks.
|
|
|
|
|
what is the difference between pointer to a function and a function pointer. how to declare these to. how to use it. can anyone explain me. thankx in advance:
|
|
|
|
|
They're the same thing. The syntax is:
return_type (calling_convention * variable_name)(parameter_list); For example:
int (__stdcall* funcPtr)() = NULL; This means funcPtr is a pointer to a __stdcall function that takes no parameters and returns an int , and the variable is initialized to NULL . The calling convention part is optional and defaults to __cdecl in C++ code.
|
|
|
|
|
hi all,
i'm novice in VC++, i tried to create a new dialobox when i click the button setting in my main callback dialog procedure, i tried this code
BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_SETTING:
set_dlg =CreateDialog( GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_SETTING),hwnd, DlgProc) ;
if(set_dlg != NULL)
{ShowWindow(set_dlg,SW_SHOW);
}
break;
can i use this method?
thx..
|
|
|
|
|
It looks ok to me. You know that makes it a modeless dialog, right?
Mark
|
|
|
|
|
thx mark for the quick reply,
but i still got nothing when the button pressed, i already build the cpp. files , is there another way? can u explain to me a little bit about modeless,
thx.
|
|
|
|
|
Have you stepped through with the debugger to see where it's failing?
Lots of good info and sample code here: Using Dialog Boxes[^]
|
|
|
|
|
ng4kau1 wrote: set_dlg =CreateDialog( GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_SETTING),hwnd, DlgProc) ;
Here, you have passed same address of diloag procedure(DlgProc ), from which this dialog is supposed to invoke. Why it is so ?
What is not working in this code ? Have you tried to debug the code ? Is is comming in case IDC_SETTING ? Is set_dlg is non - null ?
|
|
|
|
|
Hi,
I have 2 applications, A.exe and B.exe, that have the following
interaction.
A's job is to start and kill B. (LaunchProcess to start and sending
WM_QUIT to kill)
Now I need B to log that shut off, meaning I want A to notify B that it
is going to kill it and I need B to log that info before it receives
the WM_QUIT.
B is a no GUI app, it has a WinMain which does some configuration work
and then calls RunMessagePump, which is also part of my code and it
looks like this :
inline WPARAM RunMessagePump() {
// Run the usual Windows message loop.
MSG msg;
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
WM_QUIT is sent using PostThreadMessage and as far as I understand I
can not use PostMessage since B does not have any windows.
So I did some web research for PostThreadMessage and it seems like if I
send such msg to a windowless app than DispatchMessage can not handle
that since it does not know what to do with the message and it is
advised to write a thread specific hook, meaning define a callback
function, call setwindowshandler to set the callback and do all my
logging in the callback func.
However, what I do not understand is why changing the RunMessagePump
wont work, its in my code and I can change it. I tried it out and I
never receive the WM_MYMESSAGE, only the WM_QUIT, at least GetMessage
does not return that. One more thing I am concerned about is that the
MSDN documentation says that for messages WM_USER and up I need to
write my own custom marshalling. What does that mean ? What do I need
to write besides the thread-specific hook ?
Also, this all seems really complicated and delicate - any other way I
can let B know that it is going to die soon and therefore it needs to
do some special logging ?
--
Thank you!
|
|
|
|
|
You could use a message-only window[^] in B, that way A could do a normal PostMEssage or SendMessage to that window to do the communication.
|
|
|
|
|
The second process could watch for a specific event to be set, then use MsgWaiForMultipleObjects instead of your GetMessage() as the blocking call.
|
|
|
|
|
VS2005 (NOT with SP1)/MFC
When I add the OnSysCommand message handler to my app (without adding anything to it), the system menu starts acting weird. The left mouse button no longer displays the menu, and the right mouse button positions it incorrectly. On top of that, I can't resize the main window by click/dragging the border, and I can't move the window.
If I remove the OnSysCommand handler, the app behaves normally.
Has anyone ever seen that? Remember, I'm using the un-patched VS2005 with MFC.
I don't recall that happening in VC6.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: When I add the OnSysCommand message handler to my app (without adding anything to it),...
Are you calling the base class OnSysCommand()?
Mark
|
|
|
|
|
Yes. It's a naked function, exactly the way the IDE gave it to me when I added the handler.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
any chance to see a piece of code John ?
|
|
|
|
|
If you have an app handy, add a handler for OnSysCommand, and that's what I have.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Sounds like your handler is eating SC_MOVE and other SC_* commands that are generated when you use the window-management commands.
|
|
|
|
|
All SC_* commands are being passed on to the base handler.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Check this out - I posted it today:
http://www.codeproject.com/menu/System_Menu.asp[^]
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I'm trying to create a program that will, in a 30-team league, assign each team to play 6 times each against 17 teams, and 5 times each against 12 teams.
Before you read my code, you should be warned that I'm a bad coder, so if you could tell me how to organize my code better, thanks.
But my problem is that when I change this line: while(teamOpponents[a][randomMonth][randomDay] != 100 || teamOpponents[b][randomMonth][randomDay] != 100); to this line: while(teamOpponents[a][randomMonth][randomDay] != 100 || teamOpponents[b][randomMonth][randomDay] != 100 || (randomMonth == 3 && randomDay == 9)); , the compiled program will halt (compile it yourself, and you'll see) (possibly in some kind of infinite loop(?)
My bad code:
http://www.codeguru.com/forum/showthread.php?p=1522813#post1522813
|
|
|
|