|
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.)
|
|
|
|
|
Alvaro Mendez wrote:
Did you try calling DrawMenuBar?
Where must i use it in my code????
thanks
sunny
|
|
|
|
|
Well, never mind. The problem has to do with MFC's internal mechanism for menus, as Michael Dunn explains in his message.
I recommend you learn to use the MFC's mechanism instead of using the Menu API directly.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
I will try it. Thank you very much.
sunny
|
|
|
|
|
Nothing, it is perfect!!!
add, to the constructor of the mainframe
m_bAutoMenuEnable = FALSE;
see msdn article on "CMenu::EnableMenuItem"
|
|
|
|