|
- Sorry for interrupting again, Nish pal!
- I still have a question. After reading the article you introduced to me, it seems that we can not use these messages now. Are there any other methods to change the color of the caption of the button?
- Have a nice weekend,
Maer
|
|
|
|
|
see this link
http://www.codeproject.com/buttonctrl/cbuttonst.asp
Nish
Sonork ID 100.9786 voidmain
|
|
|
|
|
- Thanks pal!
- The article will be great help to me.
- Have a nice day,
Maer
|
|
|
|
|
- Please help!
- Regards,
Maer
|
|
|
|
|
Is it possible to create a window that will render HTML, something like internet explorer. As our product is dependant on the version of the common controls dll that comes with IE5 I know IE5 will be installed so can I actually use the 'Internet Explorer_Server' window class. I am restricted to the Win32 API so the MFC solutions such as CHTMLView are not available to me. Any information you can provide would be greatly appreciated.
Steve.
|
|
|
|
|
I need my program to register itself as a service
I tried (RegisteSrviceProcess)
but it doesn't work with Win2000
so I need a way to do it (way that works with Win2000)
thanks in advance
MR.Byte
|
|
|
|
|
CreateService();
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
A small update...
Something like:
schService = CreateService(
schSCManager,
TEXT(SZSERVICENAME),
TEXT(SZSERVICEDISPLAYNAME),
SERVICE_ALL_ACCESS,
SERVICE_WIN32_OWN_PROCESS,
SERVICE_DEMAND_START,
SERVICE_ERROR_NORMAL,
szPath,
NULL,
NULL,
TEXT(SZDEPENDENCIES),
NULL,
NULL);
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Under VC++, I made a DLL as -Win32 Dinamic Link-. It has only one ".C" file containing the DLLMain two Function and the callback function. The first function loads the callback function and the second function unloads the callback function. Here is how the callback is loaded:
HHOOK hhGetMsg;
HINSTANCE hInstance;
LRESULT CALLBACK GetMsg (int iCode, WPARAM wParam, LPARAM lParam);
{
hhGetMsg = SetWindowsHookEx (WH_GETMESSAGE, (HHOKPROC) GetMsg, hInstance, 0);
}
with the GetMsg sending messages to a window everytime a message pops-up. There are no filters so all messages are SUPPOSEDLY "trapped". I used SendMessage to avoid a mess. Also calls CallNextHookEx.
I have looked at other codes that SUCCESSFULLY loaded a system-wide hook and My code are basically Identical. But my hook only monitors the APP/.EXE that loads it! I don't get it! The DLL and its functions are loaded from the APP/.EXE using LoadLibrary and GetProcAddress.
Need help! Thanks in advance.
|
|
|
|
|
I guess your problem is don't put any global data in a shared section, all data you use in your hook function must be placed in a shared section so it is same as multiple DLL instances.
here is a my snippet of code...
#pragma data_seg(".shared")
HHOOK g_hMouseHook = NULL;
HINSTANCE g_hInstance = NULL;
MOUSEHOOKSTRUCT* g_pMHS = NULL;
HWND g_hLastWnd = NULL;
UINT g_nLastMessage = 0;
UINT g_nLastHitTestCode = 0;
#pragma data_seg()
#pragma comment(linker, "/section:.shared,rws")
look at MSDN for more about shared section.
|
|
|
|
|
Many Thanks
|
|
|
|
|
I actually just created a system-wide keyboard hook. It was my very first time, and I managed to do it without any knowlegde of what you're talking about. I don't even understand what it means Anyway, I didn't use any #pragma preprocessor commands or anything special. If you want to check out my source, just tell me...
Sprudling
|
|
|
|
|
I need to do something when a file is opened using the menu of a SDI application.
I tried handling the ID_FILE_OPEN message, but that removes the open dialog. I still want it to happen, but I need to do other things.
Where do I do this?
Thank You
XP
|
|
|
|
|
The document recieves a OnFileOpen message, you can do it there.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
I was wondering how many people base their error trapping on try and catch? I read in "Game Programming Gems" that exception handling was "expensive" and I wanted to know if anyone has felt this impact? I am writing a multi-client nonblocking telnet server app and speed can turn into an issue. Would I be better off to do a tradition bool or int error returns? Any input would rock!
----
Xian
|
|
|
|
|
Game programming and "normal app" programming are entirely different animals. Games are all about speed, speed, and more speed. When you write something like a Telnet app, most of your cycles will be spent waiting for the user to do something, or waiting for data to arrive via the connection.
I personally use return values for errors. It's what I'm used to and I would gain nothing by using exceptions. MHO of course.
--Mike--
http://home.inreach.com/mdunn/
#include "witty_sig.h"
your with and
|
|
|
|
|
try/catch is not expensive if it's used for unrecoverable errors. At that point you're exiting from the game anyhow. Unreal used exception handling and it's a high performance FPS. try/catch is only expensive if it's used to catch normally occuring errors.
Todd Smith
|
|
|
|
|
No text
----
Xian
|
|
|
|
|
In addition to the other replies, the "expense" of exception handling greatly depends on how it is (mis)used.
For example, wrapping your entire application's code with a single try/catch is not too expensive. But wrapping every single call to "recv(...)" or "send(...)" or every time you process a window messages (if you have a message pump) might be.
Peace!
-=- James.
|
|
|
|
|
Yeah, my main function looks kinda like this :
XGameObj * pGameObj = new XGameObj();
try
{
pGameObj->initGame();
pGameObj->startListener();
pGameObj->gameLoop();
}
catch( const char * pszError )
{
}
My support functions in my Socket handler throw back errors and if they are
bad then I throw them back to the main loop. Other than that I am not doing much with it. I only throw back to the beginning for irrecoverable errors. I hope this is the "proper" way of doing it. I pretty much just figured it out on my own. I dont try/catch every send and receive, plus this is a console app, so no windows pumps! Every heartbeat the events are fired based on time. Like connections are checked and messages are checked every beat, while updates to the queues may occur every 1 real second, etc. I am pretty much just making it up as I go along
Peace.
|
|
|
|
|
> Yeah, my main function looks kinda like this : [...]
I assume you know this, but without a "catch all" handler, you will not catch things like dereferencing a NULL pointer, or other exceptions.
-=- James.
|
|
|
|
|
I assume you know this, but without a "catch all" handler, you will not catch things like dereferencing a NULL pointer, or other exceptions.
I assume you know this, but SEGV is nothing the C++ exception mechanism would usually handle. It's a Microsoft extension. A C++ exception handler (in the context of the ISO C++ standard) handles C++ exceptions. No more, no less.
/Mike
|
|
|
|
|
The astute reader will notice that I did not (nor did anyone else, for that matter) specifically mention "Segmentation Violation", or anything else even close to Unix.
-=- James.
|
|
|
|
|
I always use CDatabase and CRecordset when I am doing windows programming. I was wondering if there is an ADO class that you can use with MFC and whether there is a simple example of it somewhere?
thanks
|
|
|
|
|
There's one here AFAIK. I just #import and use it directly myself.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|