|
Use RedrawWindow with the RDW_ERASENOW flag, and if you want a WM_PAINT message to be sent before the function exits use the RDW_UPDATENOW flag as well.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
InvalidateRect, InvalidateRgn, UpdateWindow, ValidateRect adn ValidateRgn are all implemented in terms of RedrawWindow with a different combination of flags.
Just look at the documentation for all of hte flags for RedrawWindow in order to do the task that you are looking to do. You can force the window to repaint before the function returns, or you can simply queue it to repaint a certain portion. You can force the child windows to repaint as well as the parent windows of your current window.
Here is an article that I wrote that goes into detail about RedrawWindow and the update region of a window:
Guide To Win32 Paint for Intermediates[^]
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hi CPians,
Is there an easy way to detect if a DLL is 16 or 32 bit?
Also what about EXEs?
Regards,
Victor
phpWebNotes is a page annotation system modelled after php.net.
http://webnotes.sourceforge.net/demo.php[^]
|
|
|
|
|
Probably by looking at the header. 16-bit binaries have a NE header, 32-bit have a PE header.
--Mike--
Friday's GoogleFight results: Britney Spears 2,190,000 - Erica Weichers 23
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Thanks for the hint
I had a look at a 16-bit/32-bit EXEs/DLLs and noticed the NE / PE. However, all files start with MZ which most probably reflects a DOS EXE header that acts as the stub. Do you know how to retrieve the information of the NE/PE. I assume the offset in the file might be different due to different stub sizes.
Regards,
Victor.
phpWebNotes is a page annotation system modelled after php.net.
http://webnotes.sourceforge.net/demo.php[^]
|
|
|
|
|
Matt Pietrek, "Windows 95 System Programming Secrets", Chapter 8. May be, it will help you.
|
|
|
|
|
Use SHGetFileInfo.
If uFlags contains the SHGFI_EXETYPE flag, the return value specifies the type of the executable file.
Read in MSDN about SHGetFileInfo.
|
|
|
|
|
Thanks a lot Dudi, I finally got a chance to test it and it worked like a charm..
Regards,
Victor
phpWebNotes is a page annotation system modelled after php.net.
http://webnotes.sourceforge.net/demo.php[^]
|
|
|
|
|
Ok, I keep hitting else statement saying a 'Duplicate value found in tree' following the first insert. I haven't a clue as to why, does anyone see something I am missing? Thanks in advance.
struct stars
{
char name[25];
char designation[12];
char constellation[3];
unsigned int right_asc_one;
unsigned int right_asc_two;
signed int decline_one;
unsigned int decline_two;
float vis_magnitude;
};
void BinaryTree::InsertNode(stars value)
{
TreeNode *newNode,
*nodePtr;
newNode = new TreeNode;
strcpy(newNode->value.name, value.name);
strcpy(newNode->value.designation, value.designation);
strcpy(newNode->value.constellation,value.constellation);
newNode->value.right_asc_one = value.right_asc_one;
newNode->value.right_asc_two = value.right_asc_two;
newNode->value.decline_one = value.decline_one;
newNode->value.decline_two = value.decline_two;
newNode->left = newNode->right = NULL;
if (!root)
root = newNode;
else
{
nodePtr = root;
while (nodePtr != NULL)
{
if (strcmp(value.name,nodePtr->value.name) < 0)
{
if (nodePtr->left)
nodePtr = nodePtr->left;
else
{
nodePtr->left = newNode;
break;
}
}
else if (strcmp(value.name,nodePtr->value.name) > 0)
{
if (nodePtr->right)
nodePtr = nodePtr->right;
else
{
nodePtr->right = newNode;
break;
}
}
else
{
cout << "Duplicate value found in tree.\n";
break;
}
}
}
}
Nick Parker
Not everything that can be counted counts, and not everything that counts can be counted. - Albert Einstein
|
|
|
|
|
I do nto see anything wrong. Why don't you try to see in the debugger which strings are actually stored and compared ?
~RaGE();
[Edit] I looked at it once again, and i am pretty sure you're trying to insert two times the same values.
|
|
|
|
|
Hello, I can't seem to find an elegant way to do this. I've checked all the docs I could find, went through MSDN but I think I'm missing something fundamental here:
I have a _bstr_t variable (well, technically it's an imported com function that returns a _bstr_t) and I need to use it with the CString Format function,
I.E. (simplified greatly):
CString strThis;<br />
_bstr_t _bstrThat("hello");<br />
strThis.Format("%s",_bstrThat);
Now that obviously wouldn't work so I tried various ways of casting the _bstr_t without consistent success (LPCTSTR).
What I've done that works every time is:
strThis.Format("%s",CString(_bstrThat));
But that's obviously a really bad solution (there are dozens of com calls to construct each CString required in the format function.)
I know that I can assign them to individual CString variables easily, but that would be an even worse solution in this case due to the large number of functions that need to be called in the COM server for each CString query.
(Why do I need to do this you might ask? I'm working between a COM control and a database and need to take data out of the COM control and construct a SQL query to update the database.)
Any help would be greatly appreciated.
|
|
|
|
|
A _bstr_t has overloaded operators for both const char* and const wchar_t*, so you can do something like:
strThis.Format( _T("%s"), (LPCTSTR)bstr );
and it does the appropriate conversion (unicode to TCHAR).
Dave
|
|
|
|
|
Sounds absolutely ideal and solves the problem I was seeing when I tried that but missed the _T conversion macro so was getting some strange results.
That points me in the right direction, I'll dig into the docs again now that I have an idea where I went wrong.
Thank you.
|
|
|
|
|
This should work:
strThis.Format("%s", (LPCTSTR)_bstrThat);
However, this is also perfectly fine:
strThis = _bstrThat;
or
strThis.Format("%s",CString(_bstrThat));
I don't know where you get this: there are dozens of com calls to construct each CString required in the format function. Did you actually step through the CString or bstr_t code? And even if all those calls are being made, like you say, so what? Are they really slow?
Yet other ways:
USES_CONVERSION;<br />
strThis.Format("%s", W2A(_bstrThat));
or perhaps even:
strThis.Format("%S", _bstrThat);
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
Alvaro Mendez wrote:
I don't know where you get this: there are dozens of com calls to construct each CString required in the format function. Did you actually step through the CString or bstr_t code? And even if all those calls are being made, like you say, so what? Are they really slow?
Hello Alvaro, thank you for the suggestions. What I meant by the dozens of COM calls was that I have to call the COM object which is an interface to an accounting program 12 (or more) times to retreive a complete dataset to use in my SQL append query. This means that I would need (using the current method) to call the CString constructor 12 times to construct one SQL statement. I didn't mean that COM had anything to do with CString itself.
It isn't in fact slow at all, the bottleneck is in the database update, not reading the data from the COM component and building the SQL query, that's just my "old school" programming subconscious(circa 8088 Assembler)that screams loudly when a single bit is left on the table.
|
|
|
|
|
I've been trying to find any documentation to see if there is a message, event or notification from any Win32 API that indicates that the volume on your pc has changed.
I've found things close in the MCI, DirectX sections of the API but so far no luck.
Anybody have any ideas where this might exists?
|
|
|
|
|
There is, look up the Windows Multimedia SDK in MSDN. Key API calls here are mixerOpen, mixerClose and the struct MIXERCAPS. Have a look at the VC++ sample mixapp - %programfiles%\Microsoft Visual Studio\MSDN\2001OCT\1033\SAMPLES\VC98\sdk\graphics\audio\mixapp on my machine; it's all done with the Win32 API, not an OO wrapper.
Dylan
"In meetings, the person who is least competent usually does the most talking. Talking is a direct substitute for competence, at least in the minds of other people. Five minutes after you leave a meeting, you won't remember what anyone said but you will remember who did most of the talking. Withing a day your mind will translate that into a notion that the talker was unusually knowledgeable" - Scott Adams, Dilbert and the way of the weasel
|
|
|
|
|
how to map a drive programatically ?
can any body tell ?
r00d0034@yahoo.com
|
|
|
|
|
Here's a quick and dirty way, which I believe will only work on NT/2000/XP:
WinExec("net use z: \\computer\\folder", SW_HIDE);
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
The official way appears to be via the NetUseAdd API, but it doesn't look as fun as my previous solution .
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
how to disconnect it?
r00d0034@yahoo.com
|
|
|
|
|
hello @all,
maybe, i am to stupid, but i don´t know, what i have to do. I posted this question a few days ago and i got a lot of help (thanks) but i don´t know what´s wrong?
that`s my code:
HMENU menu;<br />
<br />
menu = LoadMenu(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDR_MENU1));<br />
::SetMenu(*(AfxGetApp()->m_pMainWnd), menu);<br />
<br />
EnableMenuItem(menu, ID_EXTRAS_SERVICE, MF_GRAYED|MF_BYCOMMAND);
the problem is, that the EnableMenuItem(menu, ID_EXTRAS_SERVICE, MF_GRAYED|MF_BYCOMMAND) does not function.
what´s wrong?
thanks
sunny
|
|
|
|
|
1. Check the return value of EnableMenuItem.
2. You may need to call DrawMenuBar(AfxGetApp()->m_pMainWnd) to see the change.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
the return value of EnableMenuItem is O.
that means, it does not function, right?
thanks
sunny
|
|
|
|
|
According to MSDN, 0 means that the menu item was previously enabled (MF_ENABLED). So it's working fine. But for some reason you're not seeing the change. Did you try calling DrawMenuBar?
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|