|
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
|
|
|
|
|
How do I force the redisplay of a dialog box after it was hidden by
another dialog then unhidden ? If my application is idle the system
does this automatically but when my application is actively processing
data including serial IO it will not redisplay until it is idle again.
Can anyone help ?
|
|
|
|
|
The serial I/O code should be placed in a separate thread. This allows the main thread (the one that owns the UI) to remain responsive. By putting the Serial I/O code in the same thread as the UI, painting-related problems are to be expected.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
hi all,
i have a CListCtrl on a dialog box. i want to have the rows of the CListCtrl with variable height which is determined dynamically during program execution. i have used MeasureItem which is called only once to set the row height. also i have used DrawItem to draw the elements in the CListCtrl rows. also the CListCtrl used has three columns. how can i get columns in the CListBox
|
|
|
|
|
maxsteel wrote:
i want to have the rows of the CListCtrl with variable height which is determined dynamically during program execution.
You've found a limitation of list view controls. You might want to try a CListBox instead, which allows items to be of variable height (set the LBS_OWNERDRAWVARIABLE style).
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi all,
I always thought that it is possible to create own user rights in Windows XP like the ones you see in the "Local security settings" but I couldn't find anything about it.
Is this just impossible? Or how can it be done?
Thanks for any help,
Jens
|
|
|
|