|
I have a SDI and I dont override the standard file open ( i.e CWinApp::OnFileOpen() ), I do however use a separate CFileDialog to open a particular type of file.
When I use the CFileDialog to open my files I set the initial directory to open from (different from the executable dir). Then when I use File->Open it uses the CWinApp::OnFileOpen and the initial directory is the last directory from my CFileDialog, I expect this.
However I used SetCurrentDirectory to reset this directory but it still uses the previous value. It also uses this value when I retart the program and choose file->open.
How can I set this to always open in the executable directory for file->open. I dont want to override the OnFileOpen and use a CFileDialog.
---
|
|
|
|
|
Here's my code
int ParsePacket(BYTE *aPacket,short int iStartPos);<br />
<br />
<br />
void main()<br />
{<br />
BYTE aPacket[] = {0x59,0x89,0x59,0x59,0x23,0x59,0x59,0x59,0x89,0x59,0x00,0x54,0x65};<br />
int l = ParsePacket(aPacket,5);<br />
printf("%d\n",l<br />
system("pause");<br />
}<br />
<br />
<br />
<br />
int ParsePacket(BYTE *aPacket,short int iStartPos)<br />
{<br />
bool bFound = false;<br />
int iPos = 0;<br />
<br />
for (int i = 0;i < (sizeof(aPacket) - 1); i++)<br />
{<br />
printf("Test: %x\n",aPacket[i]);<br />
}<br />
<br />
return iPos;<br />
}
This piece of code should output twelve values ( sizeof(aPacket) = 13 ), but instead it only outputs the first three bytes of aPacket... why?
|
|
|
|
|
TO get a hint as to the problem, you should have added an printf for "sizeof(aPacket)". In the context of the ParsePacket function, sizeof(aPacket) is 4, because ParsePacket recieves aPacket as a BYTE *, and on the 32-bit x86 architecture, all pointers are 4 bytes. The sizeof operator has no way of determining the length of an array pointed to by aPacket.
i.e.:
//-----
#include <windows.h>
#include <stdio.h>
int ParsePacket(BYTE *aPacket,short int iStartPos);
void main()
{
BYTE aPacket[] = {0x59,0x89,0x59,0x59,0x23,0x59,0x59,0x59,0x89,0x59,0x00,0x54,0x65};
printf("size (in main): %i\n",sizeof(aPacket));
int l = ParsePacket(aPacket,5);
printf("%d\n",l);
system("pause");
}
int ParsePacket(BYTE * aPacket,short int iStartPos)
{
bool bFound = false;
int iPos = 0;
printf("size (in ParsePacket): %i\n",sizeof(aPacket));
for (int i = 0;i < (sizeof(aPacket) - 1); i++)
{
printf("Test: %x\n",aPacket[i]);
}
return iPos;
}
//-----
outputs:
-----
size (in main): 13
size (in ParsePacket): 4
Test: 59
Test: 89
Test: 59
0
Press any key to continue . . .
-----
You need to pass the length of the array to the ParsePacket method.
i.e.:
//-----
#include <windows.h>
#include <stdio.h>
void ParsePacket(BYTE *aPacket,int aPacketLength);
void main()
{
BYTE aPacket[] = {0x59,0x89,0x59,0x59,0x23,0x59,0x59,0x59,0x89,0x59,0x00,0x54,0x65};
ParsePacket(aPacket,sizeof(aPacket));
system("pause");
}
void ParsePacket(BYTE * aPacket,int aPacketLength)
{
for (int i = 0; i < aPacketLength; i++)
{
printf("Test: %x\n",aPacket[i]);
}
}
//-----
outputs:
-----
Test: 59
Test: 89
Test: 59
Test: 59
Test: 23
Test: 59
Test: 59
Test: 59
Test: 89
Test: 59
Test: 0
Test: 54
Test: 65
Press any key to continue . . .
-----
|
|
|
|
|
I didn't know that
Thanks a lot
|
|
|
|
|
You're very welcome. Glad I could help.
|
|
|
|
|
Hi!
The Hebrew version of my software works fine on Win XP English and Hebrew but it will display gibberish on Win98 Enabled and Hebrew. It will even mess up the fonts for the complete OS.
I havent seen the problems myself, I have someone over in Israel that is testing for me.
Is there anything to take care about for Win98 Enabled and Hebrew?
Thanks!
---------------
Tired of Spam? InboxShield for Microsoft® Outlook® and Outlook Express®
http://www.inboxshield.com
|
|
|
|
|
This is my dilema. I have somethings I'd like to accomplish. The first thing is to get stars(*) to appear when someone puts in thier pin(it's an ATM program). I haven't quite figured it out and I need help understanding it. The next thing would be help with sub-classing. I read a couple of articles on it. NCP(Number, Currency, Percentage) edit controls. The other article I read was on sub-classing. I have an understanding(I don't know for 100% though) of sub-classing for buttons. I've tried doing the same thing for edit controls but I'm having problems understanding it. I'm using Dialog Boxes. Thanx to those to have helped me before and thanx to those who wrote those articles they helped. Thanx for your time and help.
Sincerely
David "Ice"Berg
quake3b@yahoo.com
|
|
|
|
|
As for your password problem. If you go to your dialogbox and the edit box you just made. Do the following.
Right click on the edit box and go to properties. Then go to style. Put a check mark in password and then whenever you type anything in the edit box you will get ***'s. Hope this helps.
Win32newb
if (user=="Win32newb")
{
CWnd::Messagebox
("DUH");
}
ELSE
{
CWnd::Messagebox
("HELP WIN32NEWB");
}
"Making windows programs worse than they already are"
|
|
|
|
|
I'm looking for an interactive 2d graph control, but the ones in the miscellaneous controls category all seem to be static. By interactive, I mean having the ability to select and move the graphed points with the mouse.
Any ideas?
-- K
|
|
|
|
|
I'm hosting MSHTML in an Explorer bar, and a specific Web page is causing a crash in MSHTML. No other page has done that for me. I'm trying to figure out why it's happening, but I can't make sense of the call stack. MSHTML is hosted with a download control which should be preventing dynamic content from being displayed/executed, so it's curious why the call stack appears to be attempting to process some window message. Or maybe not. Any pointers? Thanks!
Here's the call stack I obtained from VS.NET:
> MSHTML.DLL!CElement::BecomeCurrent() + 0x50
MSHTML.DLL!CElement::BubbleBecomeCurrent() + 0x61
MSHTML.DLL!CMarkup::NavigateHere() + 0x47e69
MSHTML.DLL!CTaskLookForBookmark::OnRun() + 0x42
MSHTML.DLL!CTask::TaskmanRunTask() + 0x34
MSHTML.DLL!CTask::TaskmanRun() + 0xb1
MSHTML.DLL!CTask::OnTaskTick() + 0x5
MSHTML.DLL!GWMouseProc() - 0x1f0a99
MSHTML.DLL!GlobalWndProc() + 0xf9
user32.dll!_InternalCallWinProc@20() + 0x1b
user32.dll!_UserCallWinProcCheckWow@32() + 0xb7
user32.dll!_DispatchMessageWorker@8() + 0xd8
user32.dll!_DispatchMessageW@4() + 0xb
ole32.dll!CDllHost::STAWorkerLoop() + 0x69
ole32.dll!CDllHost::WorkerThread() + 0xd6
ole32.dll!DLLHostThreadEntry() + 0x9
ole32.dll!CRpcThread::WorkerLoop() + 0x1e
ole32.dll!CRpcThreadCache::RpcWorkerThreadEntry() + 0x1a
kernel32.dll!_BaseThreadStart@8() + 0x37
I have a similar call stack from WinDbg:
# ChildEBP RetAddr Args to Child
00 0b4efbc0 6363aed8 00000000 0b4efbfc 00000000 mshtml!CElement::BecomeCurrent+0x77 (FPO: [Non-Fpo])
01 0b4efc00 636d13db 00000000 00000000 00000000 mshtml!CElement::BubbleBecomeCurrent+0x81 (FPO: [Non-Fpo])
02 0b4efca4 6373deba 00000000 08ebef24 00000000 mshtml!CMarkup::NavigateHere+0x39d (FPO: [Non-Fpo])
03 0b4efcc8 636b1c42 00336b8f 08e88380 00000064 mshtml!CTaskLookForBookmark::OnRun+0x42 (FPO: [Non-Fpo])
04 0b4efcd8 636b1bf6 08e88380 00336ac7 08e8c400 mshtml!CTask::TaskmanRunTask+0x34 (FPO: [3,0,2])
05 0b4efcfc 636b1b40 63581dc7 63677b41 000003e8 mshtml!CTask::TaskmanRun+0xe4 (FPO: [Non-Fpo])
06 0b4efd00 63581dc7 63677b41 000003e8 63581d1d mshtml!CTask::OnTaskTick+0x5 (FPO: [2,0,0])
07 0b4efd0c 63581d1d 000503a0 00002000 0b4efeac mshtml!GWMouseProc+0x115 (FPO: [2,0,0])
08 0b4efe38 77d43a50 000503a0 0000033d 00002000 mshtml!GlobalWndProc+0x193 (FPO: [Non-Fpo])
09 0b4efe64 77d43b1f 63581c24 000503a0 00000113 USER32!InternalCallWinProc+0x1b
0a 0b4efecc 77d43d79 00000000 63581c24 000503a0 USER32!UserCallWinProcCheckWow+0x150 (FPO: [Non-Fpo])
0b 0b4eff2c 77d43ddf 0b4eff50 00000000 771c97df USER32!DispatchMessageWorker+0x306 (FPO: [Non-Fpo])
0c 0b4eff38 771c97df 0b4eff50 00000000 00000000 USER32!DispatchMessageW+0xb (FPO: [1,0,0])
0d 0b4eff6c 771daf11 77e7a5a2 00007530 0a1297f8 ole32!CDllHost::STAWorkerLoop+0x5a (FPO: [Non-Fpo])
0e 0b4eff8c 771dae38 771e71a8 772bb908 771b0000 ole32!CDllHost::WorkerThread+0xda (FPO: [Non-Fpo])
0f 0b4eff90 771e71a8 772bb908 771b0000 0a1297f8 ole32!DLLHostThreadEntry+0x9 (FPO: [1,0,0])
10 0b4effa8 771e7207 00221e50 7b1b0b33 77e7d33b ole32!CRpcThread::WorkerLoop+0x1e (FPO: [EBP 0x0b4effec] [0,0,4])
11 0b4effb4 77e7d33b 0a1297f8 00221e50 7b1b0b33 ole32!CRpcThreadCache::RpcWorkerThreadEntry+0x1a (FPO: [1,0,2])
12 0b4effec 00000000 771e71ed 0a1297f8 00000000 kernel32!BaseThreadStart+0x37 (FPO: [Non-Fpo])
|
|
|
|
|
Hi, i´m having some problems to install a lsp on a Windows NT 4 Service Pack 6.
It´s Fail at WSCInstallProvider(...)
The Strange Thing is that LSP is working fine on Windows 2000, and Windows XP.
I Didn´t find any changes (prototype or argument numbers) related with this function.
Somebody here knows what could be happening ?
Thanks,
Victor
|
|
|
|
|
Hello
I want To Get The Folder Of My Application , The folder My .Exe File placed there.Buf with out using GetCurrentDirectory if Posible.
Iman Ghasrfakhri
|
|
|
|
|
GetModuleFileName should do the trick for you
"You know "that look" women get when they want sex? Me neither."
--Steve Martin
|
|
|
|
|
thancks alot
Iman Ghasrfakhri
|
|
|
|
|
I have a system tray icon that displays a menu when you right click on it, but it doesn't disappear when you click elsewhere on the screen.
To make it disappear you have to click an item on the menu.
Does anyone know why this is happening?
Thanks
|
|
|
|
|
How are you responding to the right-click?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
pSubMenu->TrackPopupMenu(0, pos.x, pos.y, pMainWnd, NULL);
|
|
|
|
|
What happens if you specify TPM_LEFTALIGN as the first parameter?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
It doesn't seem to do anything, and even if it does it doesn't help.
Any other ideas?
Thanks
|
|
|
|
|
I had exactly the same problem a while ago. Search the microsoft knowledge base for Q135788 to get
the explanation.
...Create menu hMenu...
SetForegroundWindow(hWnd);
BOOL nReturn = TrackPopupMenu (hMenu, TPM_NONOTIFY | TPM_RETURNCMD | TPM_LEFTBUTTON, pt.x, pt.y, 0, hWnd, NULL);
PostMessage(hWnd, WM_NULL, 0, 0);
Iain.
|
|
|
|
|
I'm trying to localize a Windows installer package (.msi) built with VS.net 2003. I followed the steps written in MSDN.
However, only the "Preparing to install" dialog is displayed in the localized language, the rest of the installer is still in English. The language/codepage ID's seem to be OK, the localized strings are also in the MSI.
Have anyone ever met this problem? Any tips?
|
|
|
|
|
Hello, I need to merge cells (2,2) and (2,3) in a word document doing word automation with visual c++.
It makes two weeks that I am trying to do this and I haven`t got any results.
Thanks
|
|
|
|
|
I have an algo which takes in an iterator range like Func(I beg, I end).
These are randomaccess iterators so I can do stuff like beg[i] which gives me back the ref to the ith element of the underlying container:
T& t = beg[i].
Now inside the algo I want to swap the contents of say beg[i] and beg[j], and all I have info about is the range. I dont have any info about the type T within my algorithm.
However to do a swap I need a temporary variable to store one of the values :
T& temp = beg[i];
beg[i] = beg[j];
beg[j] = temp;
However, as I said, theres no info on T coming into the algo, so how would I swap the contents using these randomaccess iterators since I very well cant define a 'temp'?
thanks,
ns
|
|
|
|
|
and why you don't use std::swap() ?
Robert-Antonio
"A flower walked around a meadow. She saw a beatiful human and plucked off his head."
|
|
|
|
|
|