|
Driver development is complex and totally different to writing a user mode application. I suggest you get a good text book and start reading.
Steve
|
|
|
|
|
hi iwant to ask how i can get the full url in isapi , icant find any function return the full path , example
http://test.com/example
pMapInfo->pszURL its return /example iwant a function that return test.com/example ????
any idea????????
thanks
abdz
|
|
|
|
|
hello
I'm working on set covering problem
and i want the code of this problem with ACO or 3-flip
can u help me plz
|
|
|
|
|
Could someone tell me how to write a method overloading?
Thanks
Moujan
|
|
|
|
|
Here's an example:
void SetRect(CRect& rect);<br />
void SetRect(int top, int left, int bottom, int right);<br />
Adding this:
void SetRect(int top, int left, int width, int height);<br />
would be invalid, because a method with (int, int, int, int) already exists above.
Does that help at all?
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Thanks, but I am still confuse. You mean I should only use the first line:
void SetRect(CRect& rect); and I can exclude the second line.
Could this be an example overloading:
int foo1(int number);
int foo2(int number);
if is not, how can I make it to be a method overloading type?
Moujan
|
|
|
|
|
In my example, I overloaded the SetRect function to accept different types of parameters, but both methods accomplishes the same thing.
So you could use either method, depending on what you need to do.
CRect rc(10, 10, 100, 50);<br />
SetRect(rc);<br />
<br />
- or -<br />
<br />
SetRect(10, 10, 100, 50);
In your example, it is not overloading, since the function names are different (foo1 and foo2)
An example of overloading using your methods would be:
int foo1(int number);<br />
int foo1(float number);<br />
Another note: you CANNOT change the type of the return value.
int foo1(int number);<br />
float foo1(int number);
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
In the example that I wrote and you correct it to:
int foo1(int number);
int foo1(float number);
If I want to keep the number 1 and number 2 instead of float number that you wrote can I write the its over loading method this wasy:
int foo(int number);
int foo(intnumber1, int number);
Moujan
|
|
|
|
|
Yes.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
|
So could this be an example for method overloading?
int foo(int number);
int foo(intnumber1, int number);
Moujan
|
|
|
|
|
Yes, but be careful with default argument. The following does NOT work:
int foo(int number);
int foo(int number1, int number = 0);
Basically, any ambiguity the compiler cannot resolve will not work.
Best,
Jun
|
|
|
|
|
Hi guys,
I am trying to use openprocess however I am running into a few problems. Specifically for the last parameter of the function OpenProcess , I am wondering how would I retreive the process id using hwnd retrieved from FindWindow ? I have tried GetProcessId however that doesnt seem to work. I get a compiler error saying that its an undeclared identifier. However I have included windows.h so there should not be any problems. Would anyone know how to get the process id of a window handle?
Thanks,
Robbie
|
|
|
|
|
First note that GetProcessId requires at least Windows XP or Windows Server 2003.
Call GetWindowThreadProcessId and OpenProcess:
DWORD dwProcessID = 0;
::GetWindowThreadProcessId(hWnd, &dwProcessID);
HANDLE hProcess = ::OpenProcess(PROCESS_QUERY_INFORMATION,
FALSE,
dwProcessID);
if(NULL != hProcess)
{
::CloseHandle(hProcess);
}
else
{
DWORD dwError = ::GetLastError();
}
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
lol I just saw and used that from the MSDN and it worked. Thanks for confirming thats the right one to use!
|
|
|
|
|
You are welcome!
BTW. Is MSDN really so funny to "lol", or just my answer ?
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
I've skewed the meaning of "lol" so much that I end up including it in almost every post even if I have a straight face, but if I had to literally have a chuckle at your answer then it would have to be corniest joke I would have ever laughed at
|
|
|
|
|
Hi,
I have a login dialog on which there is a logo. In the OnPaint() function I have added some code to make the logo transparent.
But everytime I minimize the login dialog box and then maximise it again, I get Debug assersion failure. But if I do not minimize it, then the rest of the program works fine.
I am not able to figure out what I must do to correct this. If I block out the code in the OnPaint() function, this problem dosen't occure.
void CLogin::OnPaint()
{
CPaintDC dc(this);
CRect rect;
GetDlgItem(IDC_STATIC_MJ)->GetWindowRect(&rect);
ScreenToClient(&rect);
COLORREF clrDlg = GetSysColor(COLOR_BTNFACE);
m_bitmap.LoadBitmap ( IDB_MJ_SOFTWARE ) ;
CBrush mybrush, *oldbrush ;
mybrush.CreateSolidBrush ( clrDlg ) ;
oldbrush = dc.SelectObject ( &mybrush ) ;
Display ( &dc, rect.left , rect.top , RGB ( 255, 255, 255 ) ) ;
mybrush.DeleteObject( ) ;
dc.SelectObject ( oldbrush ) ;
}
Please can you tell me what I am doing wrong here.
Thanks,
Tara
Fortitudine Vincimus!
-- modified at 7:20 Sunday 2nd July, 2006
|
|
|
|
|
Aside note: in your code it's not even necessary to call mybrush.DeleteObject() because anyhow it is deleted when out-of-scope.
Ovidiu Cucu
Microsoft MVP - Visual C++
-- modified at 3:23 Monday 3rd July, 2006
|
|
|
|
|
Thanks a lot.
Its working now.
I used GetSafeHdc() but it was still giving error. But I understood that before loding a bitmap to m_bitmap , I must free it. So I used m_bitmap.DeleteObject(); and, of course the second point that you stated.
Thanks once again.
Fortitudine Vincimus!
|
|
|
|
|
Oups, I made a mistake in my previous answer.
I just have corrected it.
Also as long as we have not a CBitmap pointer, you can directly test m_hObject member instead of call GetSafeHandle, like WhiteSky already suggested.
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
SO, the reason that the assersion failure occurs is that when the dialog is minimised and then maximised, and the onPaint() function is called, the bitmap object tries to load an already loaded object. Is that correct?
Therefore, one must either delete the object before calling Load or check whether it is NULL, and call Load only if it is.
Fortitudine Vincimus!
|
|
|
|
|
You can use
if (m_bitmap.m_hObject==NULL) <br />
m_bitmap.LoadBitmap ( IDB_MJ_SOFTWARE ) ;
whitesky
|
|
|
|
|
Hi all,
I am having trouble to calculate precisly how many visible lines (according to the font currently selected) i have in my CRichEditCtrl derived class.
here is the code snippet:
// this event is EN_CHANGE
void CMyRichEditCtrl::OnEdtChange()
{
CDC* pDC = GetDC();
int nTxtLen = GetWindowTextLength();
SetSel(nTxtLen,nTxtLen);
CHARFORMAT2 cf;
GetSelectionCharFormat(cf);
int nFontSize = cf.yHeight / 20;
int nFontHeight = -MulDiv(nFontSize, GetDeviceCaps(pDC->m_hDC, LOGPIXELSY), 72);
nFontHeight *= -1;
ReleaseDC(pDC);
CRect rc;
GetRect ( rc );
int nVisibleLines = rc.Height() / nFontHeight;
nVisibleLines -= 3;
int nTotalLines = GetLineCount();
int nDelta = nTotalLines - nVisibleLines;
}
trouble is , the calculation i get is incorrect, especially when i change the font size.....
can any1 help?
thanks in advanced
Rami
|
|
|
|
|
Hi,
I'm looking for function which works reverse of QueryDosDevice. I've got a "\\Device\\HarddiskVolume1" and I want to translate it to drive letter.
-----------
Mila
|
|
|
|