|
I believe you have to supply the bitmap's dimensions in the LoadImage() and they should be correct (get them from your bitmap properties).
Igor.
|
|
|
|
|
I've done some extra scratching about and came across a variable in the constructor called m_bWindowed = TRUE;
If i change that to m_bWindowed = FALSE then my bitmap is loaded and displayed correctly.
only issue now is; my control is no visible at designtime, good but also at runtime.
I'll keep poking around, i have a feeling it could be something i selected in the wizard when i added an ATL object to my project. Thing is you should be able to reverse that setting some how.
Thanks
Gary
|
|
|
|
|
Hi All,
Well i've fixed the problem; which wasn't really a problem.
It seems that the activex test control container does not so the control the way i thought it should.
i.e it displays textout on your atl control, but not the graphic? Huh?
So i tested it in a project and the graphic appeared for design time, and disappeared at runtime. fabulous.
Thanks to everyone who helped, it was appreciated.
Thanks
Gary
|
|
|
|
|
Hallo,
I’m writing a Winlogon/Notify packet. I have therefore written a dll and made the necessaries registry entries. The communication between winlogon.exe and my dll is ok.
I’m unfortunalty facing a curious problem trying to work with the member variables from the PWLX_NOTIFICATION_INFO object passed from WinLogon.exe
Follow some code lines.
<br />
void __stdcall MyLogOn(PWLX_NOTIFICATION_INFO pInfo)<br />
{<br />
if((pInfo!=NULL)&&(pInfo->Domain != NULL))<br />
{<br />
size_t iSize;<br />
char *cDomain = NULL;<br />
iSize = wcstombs(0, pInfo->Domain,0);
cDomain = new char[iSize];<br />
cDomain[iSize] = NULL;<br />
<br />
wcstombs(cDomain, pInfo->Domain, iSize);<br />
} <br />
}<br />
<br />
What is wrong with my code?
Thanks in advance for helping.
dabayi
|
|
|
|
|
void __stdcall MyLogOn(PWLX_NOTIFICATION_INFO pInfo)
{
if((pInfo!=NULL)&&(pInfo->Domain != NULL))
{
size_t iSize;
char cDomain[200];
iSize = wcstombs(cDomain, pInfo->Domain,200);}
}
"I Think this Will Help"
[Vote One Here,.....]
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
From http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_wcstombs.asp[^]
If the mbstr argument is NULL, wcstombs returns the required size of the destination string. If wcstombs encounters a wide character it cannot be convert to a multibyte character, it returns –1 cast to type size_t.
Could it be such a character in your input string? Are you also 100% sure that pInfo->Domain is a valid string?
--
My name in Katakana is ヨルゲン.
My name in German is Jörgen.
My name in Mandarin/Kanji is 乔尔根 西格瓦德森.
I blog too now[^]
|
|
|
|
|
I have a .NET class which provides COM Interop. How does an ATL App consume this .NET class?
|
|
|
|
|
Not sure what is the problem. You do it as any other COM object.
My site - Body Jewelry
|
|
|
|
|
Hallo,
How please to get the length of a PWSTR variable.
I unfortunatly try
<br />
size_t size = 0;<br />
if(pInfo->Domain!=NULL)<br />
{<br />
size = wcstombs(0, pInfo->Domain, 0);<br />
}<br />
I want to convert the UserName and the Domain from a WLX_NOTIFICATION_INFO variable to Char.
<br />
typedef struct _WLX_NOTIFICATION_INFO { <br />
ULONG Size; <br />
ULONG Flags; <br />
PWSTR UserName; <br />
PWSTR Domain; <br />
PWSTR WindowStation; <br />
HANDLE hToken; <br />
HDESK hDesktop; <br />
PFNMSGECALLBACK pStatusCallback;<br />
} WLX_NOTIFICATION_INFO, *PWLX_NOTIFICATION_INFO;<br />
thanks a lot for your help
dabayi
|
|
|
|
|
|
Wright! That is exactly what I’m doing. It seems that you know something about it.
Let me ask you this question?
Is it correct that from the PWLX_NOTIFICATION_INFO parameter that I get passed from WinLogon contains the user name and the domain name? Or should I use other calls to get these Information? I have the impression that the UserName and Domain members are empty or not contain what I want to get.
By the way, I already try without success the wcslen.
Thanks a lot for your response
dabayi
|
|
|
|
|
Yeah i have created a WinLogon Notification Package.
dabayi wrote:
Is it correct that from the PWLX_NOTIFICATION_INFO parameter that I get passed from WinLogon contains the user name and the domain name? Or
yeah when ever the winlogon.exe call your Winlogon dll, it fill the WLX_NOTIFICATION_INFO structure for you.
dabayi wrote:
By the way, I already try without success the wcslen.
that couldn't be possible as PWSTR == wchar_t* == wchat_t [];
ok passme your email id i will send you dummy winlogon source
"I Think this Will Help"
[Vote One Here,.....]
<h5
alok="" gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Thank for the answer,
I’m using the example from MSDN. Everything is working fine. The only problem is as mentioned; I need first to convert the PWSR to LPCWSTR and later on to LPCTSTR.
How can convert the PWLX_NOTIFICATION_INFO variables Username and Domain to LPCWSTR? And how to convert LPCWSTR to LPCTSTR?
thanks
dabayi
|
|
|
|
|
Hi
I am reading in an XML(ish) file and want to pass the file handle off to different member functions depending on the section being read. New sections are being added so I wanted the code to be 'maintainable'. I am creating a map of pairs and want to call the sectionhandler for the section. I've come up with the following up to now :-
class MyFileClass
{
private:
void Section1Handler() {
void Section2Handler() {
void Section3Handler() {
public:
void ReadFile();
};
void MyFileClass::ReadFile()
{
map <string , void (MyFileClass::*)() > functionMap;
functionMap["<Section1>"] = Section1Handler;
functionMap["<Section2>"] = Section2Handler;
functionMap["<Section3>"] = Section3Handler;
ifstream myfile(....)
string myBuffer;
while (myfile)
{
getline(myfile , myBuffer)
functionMap[myBuffer]; <--- clearly won't work - it just returns the address.
//I've tried things like *(functionMap[myBuffer])(); but getting nowhere
}
}
Whilst the code might not be perfect above, it gives the idea of what I am trying to do. Call a function directly related to the content of myBuffer. That way, a new sectionhandler can be added and inserted into the map, instead of
if (myBuffer == "Section1") Section1Handler;
else if (myBuffer == "Section2") Section2Handler;
which, now I've looked at it again, doesn't seem that hard to maintain does it really? But regardless of that, I really would like to know what I'm doing wrong WRT the map of member function pointers...
Regards
Angel
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
You need to explicitly supply the object reference that the member function will be called on. So, as your code is in a member function of your class, use this:
(this->*functionMap[s])();
HTH!
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Many thanks Stuart - worked a treat.....except, if they add a new section to the XML without telling me I bombout - so I have to first makesure the handler is in the map :-
FuncMAP::iterator iter = funcMap.find(SectionSubString);
if (iter != funcMap.end())
(this->iter)(); <-- error C2064: term does not evaluate to a function
I really have tried to sort this myself - honest!! - I've tried
(this->*iter)();
(this->*(*iter))();
for now I am using the following - but that entails two map scans instead of one with the iterator
if (funcMap.find(SectionSubString) != funcMap.end())
(this->*(funcMap[SectionSubString]))();
I tried the following :-
void (MyClass::*)() fPtr; <--- can't determine what this line should be..
fPtr = funcMap[SectionSubString];//get the address
if (fPtr)//if the address is valid
(this->*fptr)() ;//call it
I've also trawled the web for something similar and come up blank....
Basically I knew virtually nothing about member function pointers, how to call them, how to define a variable to hold one etc. I still don't know much, but I can at least store one in a map and call it (if I know it is going to exist!). Any help again, much appreciated.
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
Remember that std::map::iterator returns a reference to a std::pair , where first is the key and second is the value. So, you want this code to find and (safely) call your function:
FuncMAP::iterator iter = funcMap.find(SectionSubString);
if (iter != funcMap.end())
{
(this->*(iter->second))() ;
}
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Thanks again....I can't blame that one on my lack of member function pointer knowledge can I? My STL is also in doubt!
Now, to find my next problem....
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
Sorry if this seems like a dumb question but ...
In the past I've built ATL components using only regular COM CoClasses.
Now I am working on a wrapper component to allow some legacy C++ code to be called via COM.
I've created just the basic standard ATL DLL framework with a single method that delegates the actual implementation to some legacy C++ code that I have. I pass in two strings which are source and target file paths. Then the legacy code is to be called to perform the actual work.
But I cannot call a method on the standard C++ class because even though I create a class instance, the compiler throws a C2228 error during a method call.
My ATL code looks something like:
**********************************************************************************************
STDMETHODIMP CMyWrapper::ExecuteLegacyParse(BSTR bstrSource, BSTR bstrTarget)
{
//Convert the input BSTRs to ANSI C Strings because ANSI Win32 API calls are required
USES_CONVERSION;
char* lpszSource = OLE2A(bstrSource);
char* lpszTarget = OLE2A(bstrTarget);
//So far, so good!
//Create an instance of CLegacyParse class
//No error occurs when creating the legacy CLegacyParse class which is a standard
//C++ class
CLegacyParse LegacyParse();
//So far, so good!
//The following line will not compile! I get a C2228 error - object on the left
//side of the operand must be a class/struct blah blah blah ...
int nResult = LegacyParse.ParseDocument(lpszSource, lpszTarget);
return S_OK;
}
**********************************************************************************************
So my question is, why am I able to create an instance of my CLegacyParse class (again, this is just a generic C++ class, not a CoClass), but I am not able to call a method because the compiler does not recognize my class instance reference, even though it allows the prerequisite instantiation of the C++ legacy class with no errors or warnings???
Is this a problem of COM _stdcall not being compatible with ordinary _cdecl call or something else?
Also, if I just cut and paste my legacy C++ methods into the wrapper COM CoClass as non-com private methods, and supply the function prototypes in the header, the component works fine.
But I don't want to do this because it obfuscates the fact that I simply want to create a COM callable wrapper around existing legacy C++ classes.
PLus I also want to understand exactly why it does not work calling the methods in a generic C++ class as opposed to calling them as private methods within the CoClass.
TIA
Robert
|
|
|
|
|
Hi,
following problem:
I have two different com objects which should support connection points. Both have the same interface (derived) and now both should have the same connection point to use 'follow up' code and the sink for both objects like:
CComQIPtr<imyinterface> p;
if(something == 1)
p.CreateInstance("Dummy.Interface");
else
p.CreateInstance("OtherDummy.Interface");
...
and here comes the problem to advise the sink I have to give the DIID_ ... and they are different for both objects:
p.Advise(pUnk, DIID_DummyEvents, &dw) and p.Advise(pUnk, DIID_OtherDummyEvents, &dw)
what I want for both is
p.Advise(pUnk, DIID_Events, &dw)
AND
in the 'sink' class once again the same. want to use same sink for both objects cause both events should be handled the same way!
Some ideas to solve this misery???
thx&greets
|
|
|
|
|
Hi all ,
I have a an ATL dialog box with a few Edit Boxes in it
and I wanted to add a ListView Control . It worked fine
but when I add the List Control using the Resource editor
I get an assertion failure (::IsWindow()fails) whenever
I call ShowWindow(SW_NORMAL) :
CClientDlg* pDlg=NULL; //MY DIALOG CLASS CClientDlg:public CDialogImpl
pDlg=new CClientDlg;
if(pDlg!=NULL)
{
pDlg->Create(NULL);
pDlg->ShowWindow(SW_NORMAL) //ASSERTION FAILURE ::IsWindow()
}
OnInitDialog(...) isnt being called during Create if I add the ListView control
and so I think this is why IsWindow fails when tested in ShowWindow . My intention
was to have a CListViewCtrl (from ATLControls.h) as a member of CClientDlg and attach
my control IDC_LIST to it in OnInitDialog(...)but im not even getting this far ...
LRESULT CClientDlg::OnInitDialog(UINT uMsg,WPARAM wParam,LPARAM lParam,BOOL &bHandled)
{
m_list.Attach(GetDlgItem(IDC_LIST)); //MY LIST VIEW CLASS CListViewCtrl m_list;
return 1;
}
If anyone can see my error or suggest an alternative method i would be very grateful.
Abel.
|
|
|
|
|
|
Thanks Mike - that's sorted it .
|
|
|
|
|
I have developed a sink ATL Dll using microsoft sample code for exchange store events but nothing happens when I try to debug my C++ code for the com object. I attach my visual C++ debuger to the processes inetinfo.exe and then to store.exe but apperenlty the com object is not being created when I send a message to administrator through outlook web access. I my running Exchange 2003.
Anything special needs to be done?
Thanks
In Advance
Majid
|
|
|
|
|
I want to generate random numbers.
plz. help me...
|
|
|
|