|
I have 2-files: program.exe and update.exe.
Lets say the user clicks update and that downloads
program1.exe which is new and improved. If program
was executed, from update.exe, how can I close
program.exe so that I can then delete it and rename
program1?
Im stuck. I cant figure out how to close a program
which is currently running. Im looking for the
opposite of ShellExecute.
Please, any response any one can give me will be
greatly appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
|
I need major help understanding how to create and manipulate non-blocking sockets in c/c++. I have to create a program for my CS470(Intro to Networking) class. This program needs to simulate the "Go back n" algorithm. In order to do this I need to use non-blocking sockets. I dont think I understand the select() function or how to use the FD_SET() functions. I am using MS C++ 6.0 and winsock. Can some one please help this poor desperate student?
PS
I went to my professor for help and he told me that I should go to google for help. I have already been google-ing it up for the prior few weeks. I dont think the professor even knows how to write the program. I wonder why I am in college if all the answers were in google to begin with?
Joe UAH student
|
|
|
|
|
Before calling connect() :
unsigned long ul = 1;
SOCKET rSocket;
int nResult = ioctlsocket(rSocket, FIONBIO, (unsigned long *) &ul); Before calling select() :
timeval tv = {0};
tv.tv_sec = 5;
fd_set fdread;
FD_ZERO(&fdread);
FD_SET(rSocket, &fdread); Before calling recv() :
if (FD_ISSET(rSocket, &fdread) != 0)
...
A wise man once said that a dictionary is of no use if you do not know how to spell the word. Likewise, Google is of no use if you do not know what to search for.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi
i want to know how to set the position of the dialog to the right bottom corner of the screen.i used GetSystemMetrics to get the resolution (infact) width and height of the desktop screen.
but how can i retrive width and height of dialog? And how to retrive the hieght of the TaskBar.
1.if i get width and height of dialog,i can use SetWindowPos(...)
2.what about the tsakbar????
|
|
|
|
|
Something like this in your dialog's init method:
RECT rcDisplay,
rcDialog;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rcDisplay, 0);
GetWindowRect(&rcDialog);
rcDialog.left = rcDisplay.right - rcDialog.right;
rcDialog.top = rcDisplay.bottom - rcDialog.bottom;
rcDialog.right = rcDisplay.right;
rcDialog.bottom = rcDisplay.bottom;
MoveWindow(&rcDialog);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
hi DavidCrow
thanks a lot for help!
|
|
|
|
|
My app uses a CDocument. I serialize all of my CObjects using << and >>.
I have added a CEditView and want to serialize whatever is typed into the view.
I created a sample app using CEditView and the default architecture used (CEditView*)m_listview.GetHead()->SerializeRaw(ar) to write/read the text in the CEdit view. This is no good for me since I'm writing binary with everything else that I write to the file.
Anyone know how to Serialize a CEditView as Binary?
|
|
|
|
|
Hi,
I can't seem to find how to set the transparent background for my treeview. I'm already using NM_CUSTOMDRAW to draw the items.
Any hints?
thanks!
|
|
|
|
|
Don't quote me on this, cause I'm not sure. Try SetLayeredWindowAttributes()
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
Thanks! but this function is not supported by Win8x/ME and I need something that will work with all platforms...
|
|
|
|
|
Hi All
I have an application, which I have to extend with a prining-function.
The application has two MultiDocTemplates, one on the right side, one on the left site.
+-------------------------------------+-+
|myApp |
+-------------------------------------+-+
| MultiDoc1 | MultiDoc2 |
| | - CDocument |
| | - CMDIChildWnd |
| | - CFormView |
| | |
+-----------+---------------------------+
The window (MultiDoc2: CWnd) on the right side has two splitter controls as shown here:
+---------------------------------------+
| SplitterControlTop |
| |
+---------------------------------------+
| |
| SplitterControlBottom |
| |
| |
| |
| |
| |
+---------------------------------------+
CProcessView.cpp: This is the View of the MultiDocTemplate on the right side. Here I have implemented the print function, and as you see in the function OnDraw, I can print the frame title.
...
IMPLEMENT_DYNCREATE(CProcessView, CFormView)
/**
* Standard constructor
*/
CProcessView::CProcessView()
: CFormView(CProcessView::IDD)
{
//{{AFX_DATA_INIT(CProcessView)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_hWndSubView = 0;
...
void CProcessView::OnDraw(CDC* pDC)
{
CProcessDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDoc->GetNextView(pos);
pDC->TextOut(20,20, pDoc->GetFrameTitle());
}
How can I now print eighter the content of the top or bottom SplitterControl?
Thanks Adrian
|
|
|
|
|
I would like my MDI application, once it started, it will automatically perform some specific tasks such as popup a dialog, run a few controls, add a record, etc. and when done automatically exit the application.
|
|
|
|
|
exit();
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
exit();
If I write code in my sleep, does that make me brilliant, or just a lazy programmer?
My articles
www.stillwaterexpress.com
BlackDice - the programmer formerly known as bdiamond
|
|
|
|
|
PostMessage(WM_CLOSE) to the main frame is what happens when you close an application manually.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have a lot of code passing in const CString& and I am wondering, which is faster, the const CString& or else forcing the conversion to LPCTSTR and passing that as the argument. I don't even need the CString-ness of the data within the functions, just access to the raw character array. Anybody here profiled this before or looked at the assembly to know which is quicker?
|
|
|
|
|
If the routine that is being called only needs to work with the LPCTSTR and doesn't need to call GetLength, then LPCTSTR is faster. However, once you start treating string as a CString in the called routine, const CString by ref is faster. What really kills speed is just passing it by CString. Thus a copy gets created each time.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Does anybody know how to read the value DPI "Settings" displayed under
Control Panel->Display Properties->Settings->Advanced.
On a german windows installation it's called "Schriftgrad" under
Systemsteuerung->Anzeige->Einstellungen->Erweitert.
MS
|
|
|
|
|
How about from:
HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics\AppliedDPI
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
Guys/Gals,
I'm trying to find out how I can measure the amount of time a function takes to execute.
Somewhere along the line in my lengthy code , some function call is eating up more time that it should be.
How can I keep keep track of how long each function takes from the time it started executing to end of its execution.
Basically Im trying to figure out which part of the code is eating up the time.
Any ideas/thoughts would be greatly appriciated.
Thanks
|
|
|
|
|
You could write some trace info in your function to the file eg.:
functionname start : time
functionname end : time
Then you can find out maybe? There'll probably be a better way, but this could work.
good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Have you seen GetTickCount() ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Depending on precission you may want to look at QueryPerformanceFrequency() and QueryPerformanceCounter()
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|