|
I came across another article on this subject - http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=348
This article doesnt talk about DisablePAsswordCaching mentioned in the MSDN article, but says that the password is always saved at SPW and "To remember or not remember is controlled by more complex binary values hidden deep under the Protected Storage key.".
Can someone shed light as to what this author means here and how it is different from DisablePAsswordCaching?
Thanks.
|
|
|
|
|
how do you minimize or maximize a dialog from a menu?
|
|
|
|
|
One way is to send the dialog a WM_SYSCOMMAND message.
UINT uCmdType = SC_MINIMIZE;
PostMessage (WM_SYSCOMMAND, uCmdType);
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|
Hi Everyone,
I'm hooking a dos-based calculation engine("engine.exe") up to my GUI, and am having some problems. When I double click the engine.exe file, or run it from cmd it runs to completion and produces the correct output.
However when i attempt to run it from my program using either createprocess, or system(), it does not run and gives this output.
Abnormal program termination: Memory protection fault
CS:EIP = 01FFh:0000799Ch
I have swapped out the engine.exe path for several other programs, and they all work just fine from createprocess.
here is my createprocess line
fSuccess = CreateProcess((LPTSTR)ImageName,
(LPTSTR)CmdLine,
(LPSECURITY_ATTRIBUTES)NULL,
(LPSECURITY_ATTRIBUTES)NULL,
(BOOL)TRUE,(DWORD)0,NULL,
(LPTSTR)DirLine,
(LPSTARTUPINFO)&SI,(LPPROCESS_INFORMATION)& pi);
and startupinfo
SI.cb =sizeof(STARTUPINFO);
SI.lpReserved = NULL;
SI.lpDesktop=NULL;
SI.lpTitle="EngineProcess";
SI.cbReserved2=0;
SI.lpReserved2=NULL;
SI.dwFlags = STARTF_USESHOWWINDOW;
SI.wShowWindow = SW_FORCEMINIMIZE;
I'm just wondering if anyone has seen this before(unable to run dos-based programs from a VC++ program).
thanks,
Mike
"I bet Einstein turned himself all sorts of colors before he invented the light bulb." -- Homer J.
|
|
|
|
|
Just checl when launching it from double clicking it it doesnt add some command line parmeters to it self (Right click properties)
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
nope there's nothing, good thought though.
Mike
"I bet Einstein turned himself all sorts of colors before he invented the light bulb." -- Homer J.
|
|
|
|
|
I think you need to create a PIF file for the DOS program first? Never tried running a DOS app via CreateProcess(), though.
Also, look into the CREATE_NEW_CONSOLE for CreateProcess...
Bikram Singh
|
|
|
|
|
yeah, weirdest thing ...
It turns out that this problem only occurs when I launch my gui from the vc++ exclamation point (ctrl+F5)
when start the program by double-clicking the exe everything works exactly how it should.
Anybody know what extra options that exclamation-point button adds onto the executable?
thanks,
Mike
"I bet Einstein turned himself all sorts of colors before he invented the light bulb." -- Homer J.
|
|
|
|
|
With CTRL+F5, the debugger is invoked, and the program runs within the debugger.
I have experienced this anomaly before, but I cant exactly be sure why it happens. And I have seen it happen in other compilers as well...
Bikram Singh
|
|
|
|
|
oh, ok yeah that makes sense.
I'll know for next time. thanks.
Mike
|
|
|
|
|
I have been using a TreeView to navigate through folders and when I double-click on a file then it will run.
I have problems with one particular file which I think is related to the current directory.
I was getting the directory from the TreeView (C:\MyFiles\Dir1), and using this in a call to
SetCurrentDirectory(CString item);
But will this work (I dont think it does) as usually you need to use strings such as C:\\MyFiles\\Dir1.
e.g. I use the following code to set the new current directory:-
currentDirectory = find.GetFilePath();<br />
currentDirectory = currentDirectory.GetBuffer(currentDirectory.GetLength ());<br />
strcpy(CurrentPathName, currentDirectory);<br />
SetCurrentDirectory(CurrentPathName);
I did get side-tracked as used
TCHAR CurrentPathName[] = "C:\\MyFiles\\Dir1";
Things works, but do I need to process the string and insert the extra '\' character?
ANy suggestions,
Sweep
|
|
|
|
|
String Escape characters are only used in literals. Once they are in memory escape characters have no significance and are processed as any other characters.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
I am confused.
If I check the directory:-
TCHAR currentdir[255];<br />
GetCurrentDirectory(sizeof(currentdir), currentdir);<br />
ShellExecute(0, "open", m_strPath, NULL, NULL, SW_SHOWNORMAL);
Then its the director of my program, it has not changed. I did try and set it as I move through the folders (via the TreeView), but it seems not to have worked.
If I now do:-
SetCurrentDirectory("C:\\CSL");
ShellExecute(0, "open", m_strPath, NULL, NULL, SW_SHOWNORMAL);
The current directory has been set to C:\CSL and my ShellExecute command works as expected.
Question do I need to use TCHAR in some special way?
|
|
|
|
|
sweep123 wrote:
Then its the director of my program, it has not changed.
I believe we have a language barrier here, I have not idea what that means.
HINSTANCE ShellExecute(
HWND hwnd,
LPCTSTR lpOperation,
LPCTSTR lpFile,
LPCTSTR lpParameters,
LPCTSTR lpDirectory,
INT nShowCmd
);
Try using the lpDirectory parameter of the function rather than changing directories, that's what it is for.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
I am still confused!
In the DirTreeCtrl, I try and set the current directory to the on we have navigated to. (See code below)
if ( find.IsDirectory() && !find.IsDots() )<br />
{ <br />
strDirArray.Add( find.GetFilePath() );<br />
currentDirectory = find.GetFilePath();<br />
currentDirectory = currentDirectory.GetBuffer(currentDirectory.GetLength ());<br />
strcpy(CurrentPathName, currentDirectory);<br />
SetCurrentDirectory(CurrentPathName);<br />
}
Now when I double-click a file in the current directory, the displayed current directory via AfxMessageBox is the one my program started up in. Not the one I thought I set in the code above.
void CScriptingDlg::OnNMDblclkTree1(NMHDR *pNMHDR, LRESULT *pResult)<br />
{<br />
<br />
<br />
char currentdir[255];<br />
CString messageStr;<br />
GetCurrentDirectory(sizeof(currentdir), currentdir);<br />
ShellExecute(0, "open", m_strPath, NULL, "C:\\CSL", SW_SHOWNORMAL);<br />
messageStr.Format ("Current Directory = %s", currentdir);<br />
AfxMessageBox(messageStr);<br />
}
If however I use palbano suggestion in the ShellExecute command and specify the directory the script file runs OK.
But the current directory is C:\MyProgram\res and not C:\CSL. This is want I dont understand.
|
|
|
|
|
swep123 wrote:
do I need to process the string and insert the extra '\' character?
Only if you are declaring the string as a constant, like you did here:
swep123 wrote:
TCHAR CurrentPathName[] = "C:\\MyFiles\\Dir1";
Is 'find' a CFileFind object?
Bikram Singh
|
|
|
|
|
Yes,
CFileFind find;
Every time the directory changed I was trying to change the working directory:-
if ( find.IsDirectory() && !find.IsDots() )<br />
{ <br />
strDirArray.Add( find.GetFilePath() );<br />
currentDirectory = find.GetFilePath();<br />
currentDirectory = currentDirectory.GetBuffer(currentDirectory.GetLength ());<br />
strcpy(CurrentPathName, currentDirectory);<br />
SetCurrentDirectory(CurrentPathName);<br />
}
|
|
|
|
|
So where is the problem?
The following code works just fine for me:
Note: I have used '\x5c'(ascii code for a single '\') instead of using '\\' in the string literal. The code works either way.
CFileFind find;
CString CurrentDirectory;
char CurrentPathName[444];
find.FindFile("C:\x5cWindows");
find.FindNextFile();
if ( find.IsDirectory() && !find.IsDots() )
{
AfxMessageBox(CurrentPathName);
currentDirectory = find.GetFilePath();
currentDirectory = currentDirectory.GetBuffer(currentDirectory.GetLength ());
strcpy(CurrentPathName, currentDirectory);
if(SetCurrentDirectory(CurrentPathName))
AfxMessageBox("success");
AfxMessageBox(CurrentPathName);
}
Bikram Singh
|
|
|
|
|
I have a problem:
I want to display the text in the caption bar as three parts.
first part will be left aligned, second part is centered and the third part is right aligned using the title bar font and that runs correctly using different windows themes.
Thanks for co-operation
|
|
|
|
|
1. Intercept the WM_NCPAINT message for the window
2. Get the width and height of the Titlebar: see the GetSystemMetrics() function in MSDN.
3. To draw the text, use DrawText() (MSDN), and use the lpRect member to specify the rect to draw in. You would need to calculate the 3 rects needed yourself. (left,center,right)
HTH
Bikram Singh
|
|
|
|
|
|
Hi,
I have a windows service written in VC++ 6.0.
I install it using the shell
sERVICEname.exe /service
Is there any other way to install it (using VS.NET Deployment wizard)?
Also, how can we uninstall the above service once it is installed?
Regards
Vipul Patel
|
|
|
|
|
vipul_vips wrote:
Also, how can we uninstall the above service once it is installed?
servicename.exe /UnregServer
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
vipul_vips wrote:
Also, how can we uninstall the above service once it is installed?
My guess would be ControlService(..., SERVICE_CONTROL_STOP, ...) followed by a call to DeleteService() . Also, OpenService(..., DELETE) will need to be called in order to get a handle to the service.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|