|
I am missing something to get it to work; can you supply more info/working example with any headers, whatever? for instance, accessing ALLUSERSPROFILE or other?
thanks
|
|
|
|
|
Kirk Woller wrote:
can you supply more info/working example
See here[^]
|
|
|
|
|
Hello there guys.
I have something to ask about how can I customize the closing function of an application. Using MFC/VC++, a created application is run, and with that application window, there are some link that will display in a new IE window.
I wanted that if I close the main application, all IE window displayed will also close. Please tell me how I can do that, I don't have much idea about it.
Thanks.
With great power comes a great responsibility.
|
|
|
|
|
Hi,
maybe you can customize your virtual int CWinApp::ExitInstance(); method. I don't know the code you need, but if I knew, I would put it there.
Regards
Achim Klein
We can do no great things, only small things with great love. - Mother Theresa
|
|
|
|
|
Thanks for your reply.
I'll try to look at it and maybe try the ::FindWindow() and SendMessage() function calling WM_CLOSE.
Thanks again.
With great power comes a great responsibility.
|
|
|
|
|
I'm using the same source files on windows and on linux
<br />
#ifdef WIN32<br />
fd = open (*it, _O_RDONLY | _O_BINARY);<br />
#endif<br />
<br />
#ifdef __unix<br />
fd = open (*it, O_RDONLY);<br />
<br />
#endif<br />
if (fd == -1) {<br />
return 1;<br />
}<br />
<br />
Then I do stuff
and finally:
#ifdef WIN32<br />
_close(fd);<br />
#endif<br />
<br />
#ifdef __unix<br />
close(fd);<br />
#endif
Its fine on windows, crashes with an invalid pointer on linux at the close. I dont know what this means, but if instead of _close, I use close() on windows, it crashes on windows too.
How do I close my files on linux?
Thanks,
sb
-- modified at 15:58 Tuesday 20th September, 2005
|
|
|
|
|
Is it possible that __unix and WIN32 exist at the same time?
bonosa wrote:
How do I close my files on linux?
What close-type functions exist in the io.h file on that platform?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
No. The flags are distinct and working ok.
As for io.h on linux the one i found in /usr/include/asm/ didnt have the word close in it. The unix man for close() seems to indicate that its what I want (in unistd.h). But it crashes.
Theres a lot of code written that uses _open and _close, so I dont want to change over to fopen, fclose. I might have to though
Thanks,
sb
|
|
|
|
|
I just stumbled on to this:
http://www.awprofessional.com/articles/article.asp?p=99706&seqNum=5&rl=1[^]
says:
When a process terminates, all open files are automatically closed by the kernel. Many programs take advantage of this fact and don't explicitly close open files
This would explain why I get the invalid pointer crash on linux.
However, if I open too many files in my loop it chokes. Interestingly on windows strerror(errno) is 24(too many open) but on linux its 0 --- Success.
So looks like its not getting set.
Most puzzling.
Thanks for helping,
sb
How
|
|
|
|
|
bonosa wrote:
This would explain why I get the invalid pointer crash on linux.
I disagree, but if that is indeed the case, it is a very poor design on someone's part. Windows has the same sort of functionality in that it will close file handles and free up memory when an application terminates. However, if that application has already done its own house cleaning, Windows just moves on to something else. It's not going to try and close a handle that is not open or free memory that is not still allocated.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi all,
I have three questions about changing an edit box BG color:
I am trying to change the background color of a multi line edit box, I use the WM_CTLCOLOR message and it works but:
First:
initially, when the color changes, the area that changes is only the first line of the edit box (the first line has the desired background color, while the other lines have the white(default) background color), and as I add lines (Enter Key) the following line changes color and so on.
how to solve this situation? I want the whole control to be painted with the desired bg color.
Second, Even when I change the color of a single line edit box, the color changes, but there still small rectangles of the default bg color in the bottom and the right side of the edit box, it really doesnt exactly have the same effect as writing in VB:
Text1.BGColor=vbBlack
Why?!!!
Thrid and last,
When I use the WM_CTLCOLOR message to change my edit box bg color, if the Locked state of the edit box is set, the color is not changed at all, I dont think its wrong to have a locked edit box with a black bg color.
how to solve this?
I hope I will find some help here.
Regards,
Mohammad Gdeisat
|
|
|
|
|
You should be using WM_CTLCOLOREDIT. Also you should return the handle of the brush that Windows should use to paint the background of the control. If you just use SetBkColor and don't return a brush handle then I seem to recall that you get the results you describe.
Hope that's of some help.
|
|
|
|
|
Hi all, I'm trying to track down an old manual/software for a program called InnerView by TMS software.
Back in 1991/1992 TMS had a product called Innerview which allowed developers to create links between
HTML and images. I'm doing some research and would like to obtain an old copy of the software /
manuals from the 2.1 or similar version of the software.
Short of that I'd be interested in possibly speaking with someone who was very familiar with the
Innerview application of that time frame.
Thank you in advance for any assistance that you might be able to provide.
Respectfully,
Dave
davem@tdata.com
|
|
|
|
|
Is this ebay?
Don't try it, just do it!
|
|
|
|
|
Hi all,
Is it possible to retrieve previously selected index when an ON_LBN_SELCHANGE is fired from a CListBox control? It appears to me that I need to store such information manually.
Thank you!
|
|
|
|
|
An application sends the LBN_SELCHANGE notification message when the selection in a list box is about to change...
So the selection has not yet changed in the moment you receive that notification. CListBox::GetCurSel should return the previously selected item.
Don't try it, just do it!
|
|
|
|
|
Hmm...it appears to me that CListBox::GetCurSel returns the newly selected item not the previous one? What did I miss?
Thanks for the reply
|
|
|
|
|
Can I display SlidderBar in the semi-circle shape,as it looks in the straight line by default.
Its my project requirement,if possible please answer my question and post it as early as possible.
P.S.Kiranmaye
|
|
|
|
|
P.Sunitha Kiranmaye wrote:
Can I display SlidderBar in the semi-circle shape,as it looks in the straight line by default.
Not by default. You'll need to draw this one yourself.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
As David said, you have to draw it yourself. Look here[^] for some examples of custom drawn slider controls.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
I'm trying to write a program that will initiate a batch file. For some reason the program keeps crashing. I'm not too familiar with the createprocess function so I figure I'm doing something wrong with that. To run the program in a DOS prompt I must be in the path U://telmage/ To run the process I type telmage 09 19 05 or the previous days date. Does anyone have any idea what I might be doing wrong?
[CODE]
void main()
{
char path_buffer[_MAX_PATH];
char GTime[80];
time_t now;
UINT value;
now = time(NULL);
time_t yesterday = now - 86400;
strftime(GTime,sizeof GTime,"telmage %m %d %y",localtime(&yesterday));
_makepath( path_buffer, "U", "\\telmage", GTime, "" );
cout<
|
|
|
|
|
I would create a .bat file with the following commands in it:
U:
cd \telmage
telmage 09 19 05
and then call CreateProcess() specifying the .bat file as the command to run.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
So what you're saying is write a batch file that will take in the date and then call the original batch file to run? That makes sense but why can the original batch file be called from the prog? Also this is something I am wanting to be automated and run every day. So I can't just have a static date.
|
|
|
|
|
Camron wrote:
So what you're saying is write a batch file that will take in the date and then call the original batch file to run?
No. The batch file you create at runtime will contain those commands that you would otherwise issue at a command prompt.
Camron wrote:
That makes sense but why can the original batch file be called from the prog?
I assume you mean why can't it be called from the program. It can with a fair amount of finagling. I find it much easier to do it this way.
Camron wrote:
Also this is something I am wanting to be automated and run every day. So I can't just have a static date.
No need to. You create the .bat file each time you need it, specifying a different date each time. When you are all done, simply remove the .bat file.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I'm not sure why you need to use CreateProcess. And why not programmatically create the batch file each time? For example,
#include <fstream.h><br />
<br />
fstream batchFile;<br />
batchFile.open("Launch.bat", ios::out);<br />
if(!batchFile){ }<br />
<br />
batchFile << "U:" << endl;<br />
batchFile << "cd \\telmage" << endl;<br />
strftime(GTime, sizeof(GTime), "%m %d %y", localtime(&yesterday));<br />
batchFile << "telmage " << GTime << endl;<br />
<br />
batchFile.close();<br />
<br />
if(WinExec("Launch.bat", 0) < 32){<br />
}<br />
<br />
This code works like DavidCrow suggests, with a batch file calling the original batch file, only you won't have to recreate the calling batch file every day by hand.
Hope this helps!
Danny
-- modified at 13:16 Tuesday 20th September, 2005
|
|
|
|