|
Hi there,
I created a process that opens up a word file and its contents are parsed. Now, when the user tries to open up the exact same file, it doesn't parse. Is it because the file is currently open? How do I check that and would I need to terminate the process before creating a new one? Here is what I have so far.
Thanks!
/*************************************************/
STARTUPINFO stStartUpInfo;
PROCESS_INFORMATION pProcessInfo = new PROCESS_INFORMATION;
memset(&startInfo, 0, sizeof(STARTUPINFO));
startInfo.cb = sizeof(STARTUPINFO);
startInfo.dwFlags = STARTF_USESHOWWINDOW;
startInfo.wShowWindow = SW_SHOWDEFAULT;
CreateProcess(NULL, cmdline, NULL, NULL, FALSE,
NORMAL_PRIORITY_CLASS, NULL,
NULL, &startInfo, procInfo);
ParseFile();
/********************************/
int CParser::ParseFile(CString filename)
{
int ret = 0;
CStdioFile fname;
if (fname.Open(filename, CFile::modeRead))
{
//parsing code here
}
else
{
ret = -1;
fname.Close();
}
return ret;
}
|
|
|
|
|
Hi,
How to send msg to a window where i can't reach..
e.g: Mainframe=>splitter pane=>frame=>splitter pane=>formview
now I want to sen msg from mainfrm to formview..
How can i send this..
THAT'S THE QUESTION.
Thanks
Sumit Kapoor---
|
|
|
|
|
Use the API function GetWindow to walk down the child list of each window below Mainframe. You'll need some way to identify the correct children (assuming that one or more of the levels has > 1 child) but as you assumedly know who you're trying to send a message to that shouldn't be a problem.
Does that help?
Chris
|
|
|
|
|
Hi Dear,
I want to send a Message to sub-sub window class...
I know there is role of Spy++ in this...
please give me any idea..what to find in spy++ & How to send messag to that class..
If possible code snippet for msg send...Please....
Thanks
---Sumit Kapoor---
|
|
|
|
|
Take a look at either the SendMessage() or PostMessage() API calls in MSDN.
Jeremy Falcon
|
|
|
|
|
hi,
my actual class is so deep I cann't use send message from mainframe to that class.
I think need to use spy++..but how to..I don't know..Plesase help me..
Thanks
Sumit Kapoor--- sumit_kapoor1980@hotmail.com
|
|
|
|
|
If you have a handle to the child window, just use SendMessage() . Otherwise, if you are using MFC, does SendMessageToDescendants() help?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
hi,
my actual class is so deep I cann't use send message from mainframe to that class.
I think need to use spy++..but how to..I don't know..Plesase help me..
Thanks
---Sumit Kapoor--- sumit_kapoor1980@hotmail.com
|
|
|
|
|
So what exactly is your question - how to send a message to a child window, or how to use Spy++?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
How can I run HTML application from my MFC project, I found that \ CreatProcess() can run .exe but not HTML.
Michael Geffen
|
|
|
|
|
|
Have you looked into ShellExecute(..., "open", ...) ?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I have much older program, they using old way about pointer.
// Old code 1
void Func()
{
char *p = "Hello";
*p = 'h'; // It has "Access Violation" probelm in VC++6.0!
}
// Old code 2
void Func()
{
long ptr;
char p[];
ptr = p // has problem with type !!
}
Shoud I change all bad code ???? Do we has nother way to use older codes?
|
|
|
|
|
lewislewis_lewis wrote:
char p[];
There must be a number of some sort holding the brackets apart (e.g., char p[5] ), or p must be initialized to something that has a size (e.g., char p[] = "Hi" ).
lewislewis_lewis wrote:
Shoud I change all bad code ????
Yes, most definitely!
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Can we use some special compiling prameter setting to fix is?
Thank you!!!
|
|
|
|
|
To fix what exactly?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I means let the old program running well on VC++ 6.0. Because the old program made on VC4.0, and it work well. The program is very big, so i would not like change it.
Thanks
|
|
|
|
|
*p = 'h' tries to modify the memory holding a string literal. This is not something you should do because the memory might be read-only (thus generating a GPF when you write to it). Even if it works, it may not work on all compilers or OSes.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Windows troubleshooting: Reboot first, ask questions later.
|
|
|
|
|
Michael Dunn wrote:
This is not something you should do because the memory might be read-only (thus generating a GPF when you write to it).
What if your memory is properly allocated? See my other post in this thread for an example.
Jeremy Falcon
|
|
|
|
|
lewislewis_lewis wrote:
char *p = "Hello";
That's a huge no-no for a number of reasons, and a memory error waiting to happen. For one, if you don't allocate your memory, you're not guaranteed to have it available for your program to use.
Instead Func() should look like this:
void Func()
{
char p[] = "Hello";
*p = 'h';
} In this instance, *p acts just like p[0].
Jeremy Falcon
|
|
|
|
|
Thanks a lot for your nice help,Greeeg.
i use ShellExcute() But i do not know how i use TEMP . and create temporary file in windows
and then use it for my works?
if u have any reference please tell me what?
and how can i use it.
Best regards.
|
|
|
|
|
mostafa_pasha wrote:
...and create temporary file in windows
Use GetTempFileName() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hello!
I have an edit box on a pop-up window that receives messages from the main program and displays them. Right now I am using the SetDlgItemText to set the edit box text, and then using RedrawWindow to send the text.
My problem is this: using the commands listed above, the previous string is deleted when the new text is sent. For example, if I first send a string to the text box, that text is deleted when I send another string.
I am wanting to add another string on the line below the first string, without deleting it. For example, I want to send the first string to the text box and display, then I want to send the second string and display it under the first string. I do no know how to make the text not disappear every time I send a new string.
Thanks for your help,
Loren
|
|
|
|
|
How do you send the test to the edit box? Are you sending an actual windows message or an arbitrary message and the updating the edit box?
Kuphryn
|
|
|
|
|
It sounds like you need to use CEdit::ReplaceSel() instead, or use a listbox instead of an edit control.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|