|
|
what about adding the exe as resource.
|
|
|
|
|
ya excatly, do u know any thread in codeguru????
|
|
|
|
|
u can search for it,
but actually it is very easy,
1. add the exe as custom resource
2. load the resource LoadResource()
3. Get the buffer pointer to the resource using LockResource().
4. Then save the data to a file.
if u refer the api u will get the example code.
|
|
|
|
|
|
swarup wrote: got it, i think i was being a bit lazy. sorry for that....
so developer forums making programmers lazy.
modified on Thursday, February 21, 2008 2:45 AM
|
|
|
|
|
swarup wrote: any thread in codeguru
Try looking at the top of the web page. You see the logo of an alien? What do the words next to it say? In big letters?
If you want to know about threads on codeguru, then you might be better *asking* on codeguru.
I'm pretty sure there are articles all about embedding and extracting abritrary resources in executables here on codeproject but apparently you are not interested in them...
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
thanks, i looked for it, did nt get, thts why the request, if u cant do by urself thn only u ask for help,ppl dont simply ask for help.........
|
|
|
|
|
I have no problem with people asking for help - what you're trying to do is not easy. I helped someone with a very similar problem last week, so please look back a few days for my name in a chain conversation.
It just amused me that you were posting on codeproject asking about threads on a different website!
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
Hi Experts,
I am filling a file content with Zero and renamed it and Delete it.
but when I rename the file and try to delete it, file file's lost contents are come back.
If I do not Rename the file everything is fine.
Its like
1.Fill content with Zero
2. szString=RenameFile(szString)
3. DeleteFile(szString);
But I put a Sleep(2000) in between 2 and 3 It works well but get slow.
Is there any workaround?
Thank You.
|
|
|
|
|
pther wrote: Fill content with Zero
You have to close the file handle first!
pther wrote: 2. szString=RenameFile(szString)
3. DeleteFile(szString);
CopyFile("Src.txt", "Dest.txt", FALSE);
DeleteFile("Src.txt");
Or
rename("Src.txt", "Dest.txt");
Maxwell Chen
|
|
|
|
|
Same I used in RenNameFile();
rename(szSourceFilePath,szNewFilePath);
|
|
|
|
|
pther wrote: Same I used in RenNameFile();
rename(szSourceFilePath,szNewFilePath);
The file might be locked.
Maxwell Chen
|
|
|
|
|
CopyFile() create another copy of that file. I do not want to create any other copy of this file.
Actuelly we want to delete the actual file not Copied file.
|
|
|
|
|
pther wrote: CopyFile() create another copy of that file. I do not want to create any other copy of this file.
It was one of the approaches to do the renaming task. Or you may try:
MoveFile("oldname", "newname");
Maxwell Chen
|
|
|
|
|
Hello,
Can you please help me understand CreateProcess() function.
I am new to this concept.
Syntax of CreateProcess() is: -
BOOL CreateProcess(
PCTSTR pszApplicationName,
PTSTR pszCommandLine,
PSECURITY_ATTRIBUTES psaProcess,
PSECURITY_ATTRIBUTES psaThread,
BOOL bInheritHandles,
DWORD fdwCreate,
PVOID pvEnvironment,
PCTSTR pszCurDir,
PSTARTUPINFO psiStartInfo,
PPROCESS_INFORMATION ppiProcInfo);
My Code snippet is: -
STARTUPINFO si = { sizeof(si) };
PROCESS_INFORMATION pi;
TCHAR szPath[] = TEXT("C:\\Documents and Settings\\abhishekc\\Desktop\\code.txt");
bool bIsProcessCreated = CreateProcess(TEXT("c:\\windows\\SYSTEM32\\notepad.exe"),szPath,NULL, NULL,FALSE, 0,
NULL, NULL, &si, &pi);
Output: -
A new Notepad file opens and dialog pop-up "The System cannot find the specified path".
====================================================================================
All the path provided are true.
CreateProcess() returns true.
I am confused among two parameters of CreateProcess() viz: PCTSTR pszApplicationName,
PTSTR pszCommandLine.
Thanks in advance.
|
|
|
|
|
Do it this way:
BOOL b = CreateProcess(
NULL,
_T("notepad.exe C:\\Documents and Settings\\abhishekc\\Desktop\\code.txt"),
NULL,
...
);
Maxwell Chen
|
|
|
|
|
|
and as a side note: whenever there is white space in the parameters to CreateProcess, make it as single parameter by adding quote to the string.
otherwise there is chance to interpret as multiple parameters
TCHAR szPath[] = TEXT("C:\\Documents and Settings\\abhishekc\\Desktop\\code.txt");
can be changed to the following, to be in safer side.
TCHAR szPath[] = TEXT("\"C:\\Documents and Settings\\abhishekc\\Desktop\\code.txt\"");
ps: i am sure this is not the problem.
|
|
|
|
|
can i embed vlc player to my application. its a dialog based application. there is activex control available for it.
|
|
|
|
|
Hi,
Can anyone please tell me a way/hint to embed word document into a C++ console based exe.
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
|
|
|
|
|
u mean u want to embed in console window strange
|
|
|
|
|
Innovative!
Maxwell Chen
|
|
|
|
|
Everyone knows that when you press the 'Enter' key or 'ESC' key in a dialog application, even if in a CEdit ctrl that has focus, the dialog will exit. If you want to prevent this unwantable annoying default behavior, you should write some code.
There is an atricle about how to catch those Enter keys in controls at CP. The author tell us to add a hanled to catch WM_GETDLGCODE message,if the function's return code is DLGC_WANTALLKEYS , then our controls will know every message and we have the right to decide what to do to those 'Enter','ESC' keys.
So I subclass a CEdit class called CMyEdit, and added two message handlers OnGetDlgCode and OnKeyDown. In CMyEdit's OnKeyDown function, I can catch VK_RETURN and VK_ESCAPE , and the dialog will not exit even if Enter or ESC is pressed in the edit ctrl. Hooray!
But!!! when I change this CMyEdit from singleline to multiline, everything changed! Now OnKeyDown function will not see VK_ESCAPE any more, but VK_RETURN is still catched. And when the ESC is pressed in the ctrl, dialog exit. Why DLGC_WANTALLKEYS doesn't work now?
After I googled for half a day. I found a solution--override CEdit's PreTranslateMessage and catch all key's there.
I want to known why DLGC_WANTALLKEYS works well for single line CEdit but not for multiline?
And which is the best way to prevent dialog from exiting when the ESC or Enter is pressed in a CEdit ctrl?
Thank you all!
A Chinese VC++ programmer
|
|
|
|
|
The simplest solution, working well, and you won't need to override anything of CEdit class:
void CTestDlg::OnBtnClickedCancel()
{
CWnd* pWnd = GetFocus();
if(pWnd == dynamic_cast<CWnd*>(&m_ctlEditMultiline)) {
return;
}
OnCancel();
}
Maxwell Chen
|
|
|
|