|
do you check errors ?
send() and recv() return -1 if they coould not have sent what they had to...
recv() also return 0 if the other side of the connection has closed the connection.
normally, you might be crash-free...!
TOXCCT >>> GEII power
|
|
|
|
|
I want to put together a small program which will go
to a server can check to see if an update exists and
if so, to go get that update and replace the current
file.
I can do a WebGrab and get txt information, but I
don't know how to get the executable file from the
server and make it replace the current file. By chance,
does a sample project exist somewhere that shows how
to do this online update?
Please, any response any one can give me will be greatly
appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
I'm certainly no expert, but it may be simpler to download a DLL, which you can then load dynamically and retrieve the addresses for your components from. Have a look at the documentation for:
FreeLibrary
LoadLibrary
GetProcAddress
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
If I've a CListBox derived class (say CListBoxEx ) that handles its own custom drawing messages, i.e. WM_MEASUREITEM and WM_DRAWITEM , is it possible for me to change the parent window of this window (using SetParent ) without the fear of not receiving the above specified messages? Actually, I need to change the parent window more than once.
I'm using VC++ 6.0 SP5 and MFC
Thanks in advance
Gurmeet S. Kochar If you believe in God, it's because of the Devil
My CodeProject Articles: HTML Reader C++ Class Library, Numeric Edit Control
|
|
|
|
|
I can only think that it may be possible to attach to a hidden window as a parent and therefore not get these messages. Though I am not 100% sure on this.
Ant.
|
|
|
|
|
How can i design application, can toggle like vc dialog?
|
|
|
|
|
I doubt anyone who reads this will have any idea what you mean. Do you mean a dialog box that has a section that can be shown or hidden ? The trick is just to use ::SetWindowPos to resize the dialog to hide/show the section you want to toggle, and set the text on the button you use to reflect the current state. If that's not what you mean, try to explain a bit better.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Like christian said. i am confused..
Which VC dialog ??
|
|
|
|
|
I was design a typeset software, so i want my user can auto change layout like "vc dialog layout"
|
|
|
|
|
Hello,
Does anyone knows how to interpret Standard Test Data Format(STDF) file using VC++ program?
Thanks,
Mar
Mar Solero Jr.
|
|
|
|
|
Sorry about a non MFC question, but I thought we should have some good C++ Programmers here.
I have a base class and a inherited class.
class base<br />
{<br />
base()<br />
Initialise();<br />
};<br />
class derived : public base<br />
{<br />
derived();<br />
Initialise();<br />
}<br />
base *root;
Within my view class I want to initialise root as either the base or derived class. I do this with the following code.
switch(version)<br />
{<br />
case 0 : root = new base; break;<br />
case 1 : root = new derived; break;<br />
}<br />
root->Initialise();
This howerver always calls base::Initialise instead of the derived even for case 1.
What can I do to call derived::Initialise ?
Of course I could create a pointer to derived and typecast chamber_root, but I dont want to do that. Also I could derive another class from base and use that instead of base.
---
|
|
|
|
|
Coremn wrote:
What can I do to call derived::Initialise
Declare Initialise() as virtual in the base class:
virtual Initialise(); BTW, it's always a good idea to specify a return type for the method, even if it returns nothing. Not specifying it is non-portable and susceptible for misinterpretation by others.
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"
|
|
|
|
|
Thankyou, that was easy and quick. (quick *slap* to the forehead)
(and yes I do actually have a return type)
---
|
|
|
|
|
Hi,
Just a quick question. I have a bitmap resource in my project and I load it by calling
LoadBitmap but how can I resize it on the fly so that it fits neatly into my window?
I need to do it before I display as I don't have control over the BitBlt display code in the MFC control.
Thanks.
|
|
|
|
|
You need to create a new bitmap that is the right size, then stretchblt your bitmap into it.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Do you have an example?
Thanks
|
|
|
|
|
If you look up stretchblt in the MSDN, I'm sure it will have an example.
Just make sure you set the correct mode ( COLORONCOLOR is the high quality one, from memory )
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
awesome
so I have done that and it works great.
With regard to releasing GDI resources I get a little confused about what I have to put back.
I have two device contexts in which I SelectObject the two bitmaps.
I re select the old bitmaps back. Is this all I have to do?
Do I need to call DeleteObject as well?
Thanks
|
|
|
|
|
Anonymous wrote:
so I have done that and it works great.
Terrific
Anonymous wrote:
I have two device contexts in which I SelectObject the two bitmaps.
I re select the old bitmaps back. Is this all I have to do?
If you're using MFC, the CDC and CBitmap classes will clean up after you once you've done the above. If you're using straight handles then you'll need to call DeleteObject yourself.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Christian Graus wrote:
If you're using MFC, the CDC and CBitmap classes will clean up after you once you've done the above. If you're using straight handles then you'll need to call DeleteObject yourself.
Not quite Christian, you do have to select the bitmaps out of the DC before you let the destructors clean up. The easiest way to call CDC::SaveDC before you select any objects in, and CDC::RestoreDC when you are finished with the DC.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote:
you do have to select the bitmaps out of the DC before you let the destructors clean up.
Um.. if you follow the conversation, what I meant by 'once you've done the above' is that the original poster indicated that he had selected the bitmaps out of the DC, and asked if he needed to call 'DeleteObject', having done that.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Ok, my bad. It is just that I have used code that leaked resources like crazy because people didn't restore the DC, they just let the destructor do it's thing. Then they would say it doesn't matter, because Win2K / XP has no limit on resource usage.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
I wrote a small program to shutdown my computer at a scheduled time (using the task scheduler to run the program at the end of the day). The program works except when I'm logged off from the computer (i.e. the welcome or login screen is displayed). The program still runs and terminates will an exit code of 0, but the shutdown never happened. Here's a sample of the code:
void CPowerdownDlg::OnOK() <br />
{<br />
if (!mode)
{<br />
HANDLE procHnd, tokHnd;<br />
<br />
procHnd = GetCurrentProcess();<br />
<br />
if (!OpenProcessToken(procHnd,TOKEN_ADJUST_PRIVILEGES,&tokHnd))<br />
return;<br />
<br />
TOKEN_PRIVILEGES tp;<br />
LUID luid;<br />
<br />
if (!LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME, &luid))<br />
return; <br />
<br />
tp.PrivilegeCount = 1;<br />
tp.Privileges[0].Luid = luid;<br />
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;<br />
<br />
AdjustTokenPrivileges(tokHnd, FALSE, &tp, 0, NULL, 0); <br />
<br />
InitiateSystemShutdownEx(NULL, NULL, 15, TRUE, FALSE, SHTDN_REASON_FLAG_PLANNED);<br />
<br />
}<br />
else if (mode == 1)
SetSuspendState(FALSE,TRUE,FALSE);<br />
else if (mode == 2)
SetSuspendState(TRUE,TRUE,FALSE);<br />
<br />
OnClose();<br />
}
This is an MFC app where the dialog displays a countdown to auto-shutdown or the user can force it manually (by clicking the OK button). Of course when no one is logged on, the program will shutdown the computer without user intervention. I've tried using ExitWindowsEx() but the results were the same. Strange though that hibernating (mode 2) works when I'm logged off. I'm using XP Pro.
I'm puzzled
reymano
|
|
|
|
|
Not really a VC++ question, but can someone point me to a link that describes how to do simple string parsing in a .cmd script. I'd like to parse an incoming arg like "1.2.3" into "1", "2" and "3".
Thanks!
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Try here[^]. They've got a lot of information on batch file 'programming', in addition to an immense pile of registry hacks.
For the basics, you can read the help for the SET, IF, and FOR commands from the command line using this:
C:\> set /? | more
Software Zen: delete this;
|
|
|
|