|
Can anybody tell me the meaning of: #define WM_GRAPHNOTIFY WM_USER+13.
Here WM_GRAPHNOTIFY is window message used in DirectX. But how this WM_USER + 13 value is set.
Even at one code, I have seen: #define WM_GRAPHNOTIFY WM_APP + 1.
Pls explain what is the purpose of these statements.
|
|
|
|
|
Read this from MSDN help:
Message numbers in the second range (WM_USER through 0x7FFF) can be defined and used by an application to send messages within a private window class. These values cannot be used to define messages that are meaningful throughout an application, because some predefined window classes already define values in this range. For example, predefined control classes such as BUTTON, EDIT, LISTBOX, and COMBOBOX may use these values. Messages in this range should not be sent to other applications unless the applications have been designed to exchange messages and to attach the same meaning to the message numbers.
That should answer your question. You can read further about the other message types on MSDN
|
|
|
|
|
I have CheckBox in TreeControl (from WTL). Please let me know how can i receive Event notification from checkbox when it is selected/unselected. I tried LButtonDOwm and OnClick but it does not work.
For LButtonDOwn i used
NOTIFY_HANDLER(IID_TC, WM_LBUTTONDOWN, OnLButtonDown) but control does not come to this.
For click i am unable to detect on which item was clicked.
NOTIFY_HANDLER(IID_TC, NM_CLICK, OnClick)
Thanks
Shiv
|
|
|
|
|
Hello,
I have a dialog based application and I have added another dialog box to the resources, made a class for it (derivated from CDialog).
I want to pop up one "new type dialog box" from the main window on action A and want it to remain there until I close it on action B. I can only close it from the (X) on the up right corner. The dialog style is pop up.
//on Action A
CNewtDlg x;
int nRet = x.DoModal();
//on Action B
// I tried 3 things to close the dialog one at each time.
// none of them works
x.EndDialog(nRet); // 1st try
x.EndDialog(0); // 2nd try
x.CloseNewDialog(); //3rd try
I also made a member function
CNewDialog::CloseNewDialog()
{
this->EndDialog(0);
}
I would be very happy if someone helped me solving this
Thank you
|
|
|
|
|
Call CDialog::OnOK() or CDialog::OnCancel();
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
caykahve wrote:
int nRet = x.DoModal();
Your dialog x is modal. That means your application waits for it to be closed to continue its work.
This way, your application encounters your tries to close the dialog x only after that has already been closed by the user.
You need to make x an non-modal dialog, and close it in the ActionB-handler.
The call to make your dialog non-modal is x.create(), but there is more to it. Please read the chapter in a good book (like the Prosise) and look examples up at CP.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
thank you
create , ShowWindow, and DestroyWindow made it work.
|
|
|
|
|
I've been tasked with looking at sorting some CDO code which runs in an NT service. It works fine from a console but when I run it as an NT service it fails when trying to log on to an Exchange 2000 server. The code uses CDO rather than Extended MAPI (which is what I would've used), and I'm tempted to rewrite it in MAPI, but it would potentially take a lot longer than just trying to fix the existing code. I know there were issues with CDO in an NT service for Exchange 4.0 and I've have found various suggestions that CDO from an NT service is definitely not recommended. Can anyone shed some light on this topic? I'm happy to rewrite using MAPI but I may need some sort of justification for the effort required.
Also, does anyone know of anny decent resources other than MSDN for CDO wrt source code, problems, bugs etc.
"The folly of man is that he dreams of what he can never achieve rather than dream of what he can."
"If you think education is expensive, try ignorance."
|
|
|
|
|
The problem, I think, is that your NT service is running under a different account (typically LocalSystem) therefore cannot open the appropriate e-mail connection. What you can do is, reconfigure the NT service to run under the correct user account (the account that owns the e-mail profile, etc.).
You can also write your code as a regular program (not as a service) and start your program with XYNTService[^].
My articles and software tools
|
|
|
|
|
Hi , Ive classic List Control with some header stuff. Now i need to manually select row but i cant find any function such as "SelectItem" or similar or any other solution. Can anyone help me plz ? Thx in advance.
|
|
|
|
|
CListCtrl::GetNextItem(-1, LVNI_SELECTED);
This is for single selection only.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
ctrl.SetItemState(index, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
Roger Allen
Sonork 100.10016
Death come early, death come late,
It takes us all, there is no reason.
For every purpose under heaven,
To each a turn, to each a season.
A time to weep and a time to sigh,
A time to laugh and a time to cry,
A time to be born and a time to die.
Dust to dust and ashes to ashes,
And so I end my song.
|
|
|
|
|
You can use CListCtrl::SetItemState
for example: SetItemState(index, LVIS_SELECTED, LVIS_SELECTED);
|
|
|
|
|
Thank you, guys
|
|
|
|
|
Hi,
I have to bite the bullet and provide a custom container class*
Broken down, here's my question:
Assume a typical array implementation with size/reserve mechanism, or an allocation granularity.
if the vector contains classes is it better to
a) allocate the "additional" elements the normal way, thus calling the default constructor immediately even for the currently unused elements
b) allocate "dumb" memory, and call the constructor explicitely (using placement new) only when an element gets into use.
(a) has lesser complexity, and less pitfalls.
OTOH, (b) is closer to a "simple containter", in that it calls only the constructor of elements that are really used (better encapsulation of the preallocation mechanism), and it might perform better in an reserve-and-append scenario: data can be appended in one pass calling copy constructors, rather than two passes (1st pass default CTor, 2nd pass assignment operator).
Comments? Ideas? Experiences?
*) STL is out for several reasons, and this time it's not because I hate STL
"Vierteile den, der sie Hure schimpft mit einem türkischen Säbel."
sighist | Agile Programming | doxygen
|
|
|
|
|
I have a number of template collection class' and use method (b) ... and method (a).
I have a bit flag(s) in my class that tracks if i'm to call the constructor and/or destructor (along with methods to set these flags of course).
If your container class is specificly for a known containee class then no worries.
If the container is a template class for any containee type (base type or class) then there are a couple things that are a pain :
- you will want to control if the container calls contructor/destructor as mentioned above.
- you can't use #defines or template versions of contructor/destructor (see below).
- ummm, some other stuff ...
// Placement new :
// The #define versions work for all types except when trying to destruct
// a base type (e.g. long).
// The template version work for all types, but can introduce more code.
// The compiler recognizes there is no destructor for base types and inserts
// a no-op function.
// The biggest problem with constructor template is that can not pass
// variable parameter list to constructor.
// Note the #define version has been left so that the parameter list
// can be tacked on.
//
#define CK_CONSTRUCTOR(TT, PTR) new(PTR) TT
#define CK_DESTRUCTOR(TT, PTR) ((TT*)(PTR))->~TT()
template<class tt=""> inline void FkConstructor ( TT *PTR ) { new(PTR) TT(); }
template<class tt=""> inline void FkDestructor ( TT *PTR ) { PTR->~TT(); }
so i end up calling FkConstructor/FkDestructor in my container (you could use CK_CONSTRUCTOR() instead).
...cmk
Save the whales - collect the whole set
|
|
|
|
|
I have developed a mutithreaded FTP application for uploading more than one files simultaneously. I have used MFC's CFTPConnection class for establishing connection and for transferring files. For every file, i have to transfer i connect to the FTP server using GetFTPConnection and then transfer file using PutFile. But after uploading few files CPU usage shoots up to 100%. Can any body tell me the reason for this.Sometimes it does not last long but sometimes it lasts long and the application hangs. Currenltly 5-6 threads are active at a time and other that this there is one more thread running in my application to chck the FTP connection is axctive or not.
|
|
|
|
|
The most likely cause for 100% CPU is that you have a runaway thread that is not correctly waiting, is stuck in an infinite loop, infinite recursion, or something like that which causes it to use all the CPU. Place a few TRACE statements in the threads and one of them will go mad with output - thats your culprit!
|
|
|
|
|
I saw the sample program of how to print out in a formview.
The code is following. Right now I want to print out the image
to fit into paper( if A3 larger image than A4). How to achieve this?
CPoint oldPoint = GetScrollPosition( );
CPoint pt( 0, 0 );//scroll to up
this->ScrollToPosition( pt );
CClientDC dc(this);
CRect rect;
m_dib.Attach( GDIUtil::GrabDIB( &dc, rect ) );
ScrollToPosition( oldPoint );
|
|
|
|
|
i use following code
#include <Iads.h>
#include <Adshlp.h>
#pragma comment(lib, "ActiveDS.Lib")
#include <COMDEF.H>
bool CheckUserADSI(const char* parUserName, const char* parCode)
{
IADsOpenDSObject* pObject = NULL;
IDispatch* pDisp = NULL;
bool RetValue = false;
HRESULT hr = S_OK;
_bstr_t UserName (parUserName);
_bstr_t Code (parCode);
hr = ADsGetObject(L"LDAP:", IID_IADsUser, (void**) &pObject);
if (SUCCEEDED(hr))
{
hr = pObject->OpenDSObject(L"LDAP://net.blum",UserName, Code, ADS_SECURE_AUTHENTICATION, &pDisp);
pObject->Release();
if (SUCCEEDED(hr))
{
RetValue = true;
}
}
pDisp = NULL;
pObject = NULL;
return RetValue;
}
when i compile the code, the compiler says:
WinLogon.obj : error LNK2001: unresolved external symbol _IID_IADsUser
Any ideas how to solve this problem ?
I've checked the platform SDK samples.. all are using this IID.. but i haven't seen a single include or lib file they were linking..
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
#include <activeds.h>
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
guess you forgot to use the <> - Tags.. so your include got stripped..
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
#include <activeds.h> is there, you just have to look real close!
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi,
use "__uuidof ( expression )", where "expression" is interface name ie "IADsUser".
The chosen One
|
|
|
|
|
How to print from the Dialog Box?
Hello!
I have come across some problem hope some one could help me out..
I have got a MFC based dialog box on which i have various controls liek edit boxes, static labels and pushbuttons. For one of the push button say whose caption is "PRINT" i have given the functionality of Printing the same dialog box. I need the dialog box to be printed as is when i click the print button. So what the code should contain and my approach is as follows...
void PrintTest:nPrint()
{
CDC dc;
CPrintDialog dlg(FALSE);
//dlg.GetDefaults();
if(dlg.DoModal() == IDOK)
dc.Attach(dlg.GetPrinterDC());
DOCINFO di;
::ZeroMemory(&di, sizeof(DOCINFO));
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = _T ("print this dialog");
dc.StartDoc(&di);
return;
}
Is my approach correct. I have a doubt, how do i get the dialog handle or the device context i mean the dialog's context so that i can pass the same to the printfunction.
Venky
|
|
|
|