|
I created 2 edit boxes using CreateWindow..
In callback function, how can i know which edit box gets/loses focus/caret when clicking in one of the boxes?
Somehow, GetFocus() returns screen handle instead of edit box.
public delegate IntPtr WndProcCallback(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
public IntPtr WndProc(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam)
{
switch (uMsg)
{
case WM_SETFOCUS:
//??? who gets focus
break;
case WM_KILLFOCUS:
///??? who loses focus
break;
default:
return CallWindowProc(lpWndProc, hWnd, uMsg, wParam, lParam);
}
return IntPtr.Zero;
}
|
|
|
|
|
Look at the[^] documentation[^] - it's the window that gets the WM_SETFOCUS/WM_KILLFOCUS message that gets/loses focus respectively.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi gentlemen,
is there an option how to obtain desktop wallpaper/background. I need to use it in the BitBlt function. I need to copy part of Desktop wallpaper/background to my appl.
I've tried:
hDesktopWindow = GetDesktopWindow();
HDC hdc = GetDC(hDesktopWindow)
or
HDC hdc = GetDC(NULL)
and than I used hdc in the BitBlt function as source hdc - but It doesn't work because I got desktop with all opened windows - I need only wallpaer without windows.
I've also tried PaintDesktop() function. It gets me the same result - results desktop with all windows.
or
HDC hdc = GetDC(GetDesktopWindow())
int iResult = GetObject(hdc,sizeof(HBITMAP), &hBitmap)
iResult is allways 0 and GetLastError gets 6 = ERROR_INVALID_HANDLE
Any idea?
Thanks.
|
|
|
|
|
daavena wrote: HDC hdc = GetDC(GetDesktopWindow())
Try HDC hdc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL) instead.
This will simply capture the existing screen on all monitors.
If you want to get the desktop wallpaper you should use
SystemParametersInfo(SPI_GETDESKWALLPAPER, ...
Look at the documentation of SystemParametersInfo Function[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi,
thanks for your reply,
Try HDC hdc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL) instead
but as you said this capture whole screen with all windows - I do not need this.
What I need is screen backgroud without any windows. Because I need copy a part of screen backgroud to my window.
I know SystemParametersInfo function. It gives me the name of wallpaper only.
|
|
|
|
|
In a multi-doc. app. with the view based on CScollView which is used to display images, I'd like to display a dialog window with some histogram graphics in it. The problem is the OnPaint function for the dialog needs a few of the document's variables to draw the image's histogram. Making the variables pulic doesn't help because the compiler says they're non-static. And I can't seem to get the GetDocument() function to work in the dialog class like it does for the View class. Is there a way to do this with GetDocument() or do I have to derive the dialog class to the View some how, or a ChildView? Any help would be appreciated.
|
|
|
|
|
Pass references or pointers to the variables into the dialog, either through a constructor or through accessors.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Aha! I think that will work. Thanks!
|
|
|
|
|
Hello,
I have a function that is called from a dll and contains static variable:
void myFn(double data)
{
static double x;
...
}
At each iteration x increases on some value.
The problem occurs when pass diffent data at the same time (i.e. call the function more than once at the same time), x variable mixes all values.
data1[] = 1,2,3
data2[] = 4,5,6
The result for the first call must be 1+2+3 = 6
The result for the second call must be 4+5+6 = 15
But now the result for the first call will be 1+4+2+5+... and so on.
How to avoid this problem?
|
|
|
|
|
At first glance, your problem sounds like one of synchronization. But then I could not figure out how you were calling myFn() . It is expecting a single argument, yet you've shown two arrays. Are you passing one member of the array with each call to myFn() ?
alikalik wrote: The result for the first call must be 1+2+3 = 6
The result for the second call must be 4+5+6 = 15
But now the result for the first call will be 1+4+2+5+... and so on.
Nothing you've shown supports this.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
alikalik wrote: call the function more than once at the same time
are you calling the DLL from multiple threads ?
|
|
|
|
|
I'm creating add-in for MS Excel.
The argument is a value in a cell.
So for instance, if I call MyFn(B11) and MyFn(B12), where B11 and B12 are cells, the result will be wrong.
|
|
|
|
|
Try putting that code in your main() function.
|
|
|
|
|
Remove the static local variable making it an argument passed by reference.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi..
return i + i;
Please let me know what does this return?
wether it reurns addition of i + i Or it returns only i.
Thanks.....
modified on Monday, June 15, 2009 1:40 PM
|
|
|
|
|
Why not just try it and see?
Anand9669 wrote: wether it reurns addition of i + i Or it returns only i.
Statements end with semicolons, so 2i will be returned. Otherwise, why would the compiler choose to ignore the + i; (and thus produce an error)?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thanks for ur reply
right now i don't have c compiler in my machine..
|
|
|
|
|
it would be very much the same in the majority of programming languages...
Assuming i is int,
int a=i+i;
return a;
does return the same value as
return i+i;
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
Thanks for ur reply..
u mean to say it is as good as
return (i + i);
and there is no need of paranthesis...
|
|
|
|
|
I am trying to handle the 'Cancel' button in my property pages (wizard) and I've implemented the 'OnQueryCancel' function to catch the cancel message successfully, but unfortunately it seems that the 'OnQueryCancel' function is being called twice if the user clicked the cancel button. Any ideas on how I could address this issue? Thanks!
virtual BOOL OnQueryCancel();
BOOL CWiz_Page1::OnQueryCancel()
{
int ret;
ret = MessageBox("Are you sure?", NULL, MB_YESNO);
if(ret == IDYES)
return true;
else
return false;
}
|
|
|
|
|
JBAK_CP wrote: ...but unfortunately it seems that the 'OnQueryCancel' function is being called twice if the user clicked the cancel button.
By default, this does not happen. You've added (or removed) something that is causing this. Trying creating a new CPropertySheet -based project from scratch and note its behavior.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Dear All,
I have problem with the CListCtrl drag and drop. I used the CreateImageEx to display the image while dragging the contents of the CListCtrl but unfortunately the image is displaying at the left top corner of the screen and not relevant to my GUI where the CListCtrl is placed.
The following is the code snippet. Please advice why the image is displayed like that.
void TestDlg::OnLvnBeginrdragList3(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
OnBegindrag(&pList, pNMHDR);
*pResult = 0;
}
void TestDlg::OnBegindrag(CListCtrl* pList, NMHDR* pNMHDR)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
if (pList->GetSelectedCount() <= 0)
return;
int iItem = pList->GetSelectedCount();
POINT pt;
m_pDragImage = CreateDragImageEx(pList, &pt);
if (m_imageList == NULL)
return;
m_pDragWnd = pList;
CPoint ptStart = pNMListView->ptAction;
ptStart -= pt;
m_pDragImage->BeginDrag(0, ptStart);
m_pDragImage->DragEnter(GetDesktopWindow(), pNMListView->ptAction);
SetCapture();
}
|
|
|
|
|
Please anybody help me!!!
|
|
|
|
|
Hello all, im very much confused with this make this snippet work,, let me explain my problem in simple. please follow the folling code.
class ClassA
{
public:
function_A();
function_B();
}
class Class1
{
public:
ClassA A1
Function_1();
}
class Class1::Function_1()
{
Dlg1.DoModal();
A1.function_A();
A1.function_B();
}
class ClassDlg
{
FunDlg();
}
ClassDlg::OnRefresh()
{
i wanted "A1.function_A();"
i wanted "A1.function_B();"
}
The Dialog window will be called by "Class1::Function_1()" so after closing the dialog window the function "A1.function_A();" and "A1.function_B();" are called in order to update the contents of the mainpage(say property page). actually the contents are modified in the dialog window. so what i wanted to do is call the functions "A1.function_A();" and "A1.function_B();" before closing the dialog window say at after pressing the"Refresh" button(OnRefresh will be called). Im confused its not just happening what i desired. can any expert give me a solution, like is there any try statement i can give..??
please help me...
|
|
|
|
|
From your question it seems that you want to call the function of classA from ClassDlg. Why don't you create the object for class A in ClassDlg as well as you do in Class1?
or please rephrase your question if I understood incorrectly.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|