|
Like2Byte wrote: Is there a built in MACRO that already does that?
I don't know. Maybe they hide that information in the documentation[^] like usual
|
|
|
|
|
It's always one keyword away. Thanks. I wasn't using the word 'Predefined' in my search - I did look, though.
Thanks again.
|
|
|
|
|
__FILE__
__FUNCTION__
http://msdn2.microsoft.com/en-us/library/b0084kay(VS.71).aspx[^]
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
|
in my app i use this line:
SetIcon(AfxGetApp()->LoadIcon(IDI_NEW_ICON), TRUE);
IDI_NEW_ICON is name of the icon listed in the resource editor.
|
|
|
|
|
Thanks
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
|
|
|
|
|
I want to use SetWaitableTimer() to wake up system.
I use the following code :
<br />
void SetTimer()<br />
{<br />
HANDLE hTimer = NULL;<br />
LARGE_INTEGER liDueTime;<br />
__int64 qwDueTime;<br />
<br />
hTimer = CreateWaitableTimer(NULL, TRUE, "C&E RC WaitableTimer");<br />
<br />
SYSTEMTIME stStartTime<br />
CTime StartTime<br />
currentTime.GetAsSystemTime(st);<br />
<br />
CTimeSpan tsOneDay(0, 0, 1, 0);<br />
<br />
time = time + tsOneDay;<br />
time.GetAsSystemTime(stStartTime);<br />
<br />
FILETIME filetime;<br />
<br />
SystemTimeToFileTime(&stStartTime, &filetime);<br />
<br />
liDueTime.LowPart = filetime.dwLowDateTime;<br />
liDueTime.HighPart = filetime.dwHighDateTime;<br />
<br />
SetWaitableTimer(hTimer, &liDueTime, 0, NULL, NULL, TRUE);
}
I would like to specify absolute time, but it doesn' work !
The absolute time in this example is one minute from current time.
-- modified at 19:49 Tuesday 4th September, 2007
|
|
|
|
|
peteryenyen wrote: but it doesn' work !
That's not specific and your code won't compile so of course it doesn't work.
|
|
|
|
|
I modify the code. Please take a look at it.
|
|
|
|
|
peteryenyen wrote: I modify the code.
If you can't post code that compiles you have lower odds of receiving help because if it doesn't compile of course it doesn't work.
|
|
|
|
|
This has to be in a faq somewhere, but data is eluding me... when I create a dialog, and the messages begin to flow into the message pump... when is CWnd guaranteed to be good?
Charlie Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
Overheard in a cubicle: "A project is just a bug under development."
Seeking to rise above the intelligence of a one eared rabbit...
Caught in a vortex of weirdness...
|
|
|
|
|
charlieg wrote: when is CWnd guaranteed to be good?
When it's window handle is "valid" or IsWindow(...) which of course happens after CreateWindow and before DestroyWindow. Also you must be accessing the object from the same thread it was created in since MFC uses TLS to maintain CWnd/HWND data (there are technotes on this). There are ways to create temporary valid CWnd objects in worker threads but you need to know what you are doing when using that technique.
|
|
|
|
|
sigh Mike, let me be more specific. Given I need to create a window that is parented by another window. I actually need to do this with an activeX control, but I think the point is valid. And, thankfully, we're single threaded for this question.
I create my object that contains my first window. The constructor fires, and messages begin to be delivered. Eventually, a WM_PAINT arrives and some basic drawing code fills in the visual portion of the window. Things quiet down after the initial burst of events. Somewhere in that initial burst of events, the window for the object is actually valid, and IsWindow goes true.
Is it after WM_CREATE? WM_PAINT? Something in win32 or mfc sets that field....
Charlie Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
Overheard in a cubicle: "A project is just a bug under development."
Seeking to rise above the intelligence of a one eared rabbit...
Caught in a vortex of weirdness...
|
|
|
|
|
charlieg wrote: I actually need to do this with an activeX control
That is a whole different question. My Visual ActiveX experiences are few and old.
|
|
|
|
|
Is there a published list of Windows events and the order they occur in? I've not been able to find one, which may mean I've overlooked something obvious. For example, I want to know every windows message that occurs when a simple dialog application launches and displays. Another example - I create an activeX control, I want to know each and every message that is sent to the control as it "activates".
Spy or the version mentioned on Winspector might provide a starting list, but I'm looking for something blessed by Microsoft.
Charlie Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
Overheard in a cubicle: "A project is just a bug under development."
Seeking to rise above the intelligence of a one eared rabbit...
Caught in a vortex of weirdness...
|
|
|
|
|
charlieg wrote: I create an activeX control, I want to know each and every message that is sent to the control as it "activates".
There's a tool called 'ActiveX control test container' that will be installed as part of your Visual studio. Find it in start menu under vs tools.
For messages, I've learned them during development. I think this is basic Win32 programming or windows programming that you are looking for. Such things should be described in books about win32, or about windows in MSDN and I don't know a good exact source.
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
Hamed,
I know about the test container, but what's your point? It doesn't really show me anything about events. Are you implying that I should use the debugger to catch the events?
As far as "learning from development", point taken, but I was hoping for a definitive list, thus sayeth MSDN (of course, you can't find it in msdn....). I've found that you can pick up bad assumptions and misunderstandings from test data.
chg
Charlie Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
Overheard in a cubicle: "A project is just a bug under development."
Seeking to rise above the intelligence of a one eared rabbit...
Caught in a vortex of weirdness...
|
|
|
|
|
charlieg wrote: Are you implying that I should use the debugger to catch the events?
I didn't work a lot with activeXs but as much as I remember When I was testing my controls, I could see event's (perhaps only those that I handled or called 'Fire' for), even in release mode, in the big edit box at the bottom of the window. I'm sorry. I didn't read the text completely and thought you don't know about the tool at all.
charlieg wrote: of course, you can't find it in msdn....
I'm not sure. Some times that's right, but first that I started programming it was my best friend. Articles like the following and even better ones that I can't find now, helped me a lot. You sure read them already and perhaps were useful to you too.
http://msdn2.microsoft.com/en-us/library/ms632597.aspx[^]
http://msdn2.microsoft.com/en-us/library/ms632598.aspx[^]
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
What messages are sent and in what order is subject to change.
There's no guarantee that it will be the same on different OS versions/builds.
You could peek at each message and log it fairly easily. You'll probably find that the messages
and the order they are sent in is pretty consistent. I've never seen anything that states you
can rely on this, however.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Excellent comment Mark. So, if a developer cannot depend on the order of events, how then does one determine when a windows object is fully instantiated? Another thread says to use IsWindow() to determine when things are ready to go... but this would seem to me to be a bit of a polling solution.
Charlie Gilley
Will program for food...
Whoever said children were cheaper by the dozen... lied.
Overheard in a cubicle: "A project is just a bug under development."
Seeking to rise above the intelligence of a one eared rabbit...
Caught in a vortex of weirdness...
|
|
|
|
|
charlieg wrote: how then does one determine when a windows object is fully instantiated?
If you create a window yourself, then the returned HWND from the create API
is (obviously) valid.
*Sorry, I hit the Post message button LOL*
From the window proc's point of view, the effective lifetime of the window is from
WM_CREATE/WM_INITDIALOG to WM_NCDESTROY.
As far as documentation, you can kind of follow it from CreateWindow...
CreateWindow()
"Before returning, CreateWindow sends a WM_CREATE message to the window procedure."
WM_CREATE
"The window procedure of the new window receives this message after the window is created,
but before the window becomes visible."
WM_DESTROY
"It is sent to the window procedure of the window being destroyed after the window is removed
from the screen."
"During the processing of the message, it can be assumed that all child windows still exist."
WM_NCDESTROY
"The WM_NCDESTROY message is sent after the child windows have been destroyed. In contrast,
WM_DESTROY is sent before the child windows are destroyed."
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hello,
I made my own browser by using CHtmlView,
and I would like to add some functions which are.....
1) I want to active focus to link which is the very first tab in red color.
2) if i press down Key which is in my keyboard, i would like to move
the active focus to next other link or check box ... etc. (similar to pressing Tab Key)
3) if i press up Key which is in my keyboard, i would like to move
the active focus to back to previous link or check box ...etc.
4) if i press right Key the current active focus link goes to it's other site.
to do these I reviewed the IHTML Interfaces...but couldn't found it.
so I would like to know the IHTML Interface and the method which will do the job
what i want...and I also want to know how could I call the IHTML Interface.
thanks for reading....please help~~~~
heres my signature
|
|
|
|
|
I am using a class derived from clistctrl. I am using the CreateDragImage function to create the image shown when dragging. My understanding is that this should create an image of both the icon displayed as well as the text for the particular item I am dragging, however all I am getting is the icon with no text. I am sure this has something to do with the fact that this is a derived class, but does anyone know any other workarounds for getting the text to display in the drag image?
Thanks,
Derrick
|
|
|
|
|
I dont know if I may have to manually create the bitmap image of the text and put that in the imagelist. If so does anyone know how to do that?
|
|
|
|
|
Hi all,
I'm making use of an ODBC class written by Carlos Antollini called 'A set of ODBC Classes'. The problem is that in my one function I create an instance of the class and connect to a database. Then I dissconnect. Then later on I start another funtion to perform some transactions of the database, but the I receive an error stating: Exception Message: External exception C0000008. I think it has something to do with the allocation of the environment handle. Because if I remove the first function call it works. But the later on, on a next call it fails again. It fails on this call:
ret = SQLDriverConnect(m_hDbc,
hWnd,
(SQLCHAR*)szConnStr,
SQL_NTS,
(SQLCHAR*)szConnStrOut,
sizeof(szConnStrOut),
&pcbConnStrOut,
(SQLUSMALLINT)drvConn);
Can one assign more than one environment handle when creating more than one instance of the class???
Can anyone please help me.
Many thanks in advance
Regards,
-- modified at 8:20 Tuesday 4th September, 2007
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|