|
Ralph Wetzel wrote:
#include <atlstr.h> ... to use ATL::CString
#include <atlmisc.h> ... to use WTL::CString
I Couldn't find these two file in both of my compiler i.e. Visual Studio 6.0 and Visual Studio .Net.
Could you please tell how to use this two class.
thanks
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
You need atlmisc.h which comes with the other WTL headers you have to download from microsoft.
Then you need to define _WTL_USE_CSTRING to forward declare the CString class.
Look at the Beginner WTL tutorials here at codeproject (for example WTL for MFC programmers Part II covers including CString right at the beginning)
--Constantin
|
|
|
|
|
i am extremly thankful to u!
Thanks once again.
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
|
hi,
i added a custom resource to visual studio and im trying to do FindResource()
but it always return me null.
<br />
FindResource(_AtlModule.GetResourceInstance(), Xi_Name, "TEMPLATES");<br />
anyone know's whatsmy problem?
|
|
|
|
|
i have a OCX made in VB
when used in VB it has a function
func1( t1 as Integer, t2 as Integer)
if i use this OCX in MFC ( import )
the func ends up like
func1(short * t1,short * t2);
the func works fine in vb
but if i call it from MFC using short *
it doesn't work i tried passing short * and variants with integers and other stuff but no luck
how should i call it, why is there short * but just an integer in VB
please help
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
short x = 1234;
short y = 5678;
func1(&x, &y); It looks like VB defaults to pass by reference. Try modifying the VB function to "func1(t1 as ByVal Integer, t2 as ByVal Integer)" and see if what happens in the generated C++ source.
--
My name in Katakana is ヨレゲン.
My name in German is Jörgen.
I blog too now[^]
|
|
|
|
|
Jörgen Sigvardsson wrote:
short x = 1234;short y = 5678;func1(&x, &y);
yes tried that doesn't work
unfortunatly i don't have the source code for the vb dll
the above stuff should but it doesn't
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
How to use FindResourceEx for multiple dialog resources for different languages.
|
|
|
|
|
hi,
im coding an Add-In (Visual C++) that do some changes to the document files in Visual Studio (.NET).
in the code i need to get the Active Project that in the solution explorer (the one that will run when the project is execute).
how can i do that?
in MFC i think , in the class IApplication, there's ->get_ActiveProject,
but in the classes of EnvDTE there's not (i didn't find).
does anyone know about something like that? or is there another way to know which is the active/startup project?
thanks in advance,
Avi.
|
|
|
|
|
Looking at a (good) sample add-in that comes with source code(Fast Solution Build by Joshua Jensen[^]), it looks like:
The DTE has a property called Solution, which has a property called SolutionBuild, which has a property called StartupProjects. This is the list of startup projects for the solution.
HTH!
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
|
Hallo,
I’m facing a winlogon/Notify problem.
I’m creating to Winlogon Notification Package. I have therefore written an ATL DLL with a winlogonevent handler function. I exported the winlogon event handler function with the “MyProjectName.def” file as follows
LIBRARY "MyProjectNamaePS"
EXPORTS
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE
GetProxyDllInfo PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
fLogonEventHandler PRIVATE
fLogoutEventHandler PRIVATE
From the fLogonEventHandler function I’m doing the following things
void fLogonEventHandler (PWLX_NOTIFICATION_INFO pInfo)
{
LPCTSTR lpTestValue;
HKEY hk;
DWORD dwData, dwDisp;
TCHAR BufSubkey[MAX_PATH];
LPTSTR MyTestValue;
long HRESULT;
BOOL BRESULT = 0;
LPCTSTR lpCaption;
TCHAR msg[128];
lpCaption = TEXT("OK");
wsprintf(msg, "It's OK!");
MessageBox(NULL, msg, lpCaption, MB_OK);
dwData = 1;
MyTestValue = TEXT("Test Value\n");
wsprintf(BufSubkey,"MyTESTCONTROL"\\TEST");
HRESULT = -1;
HRESULT = RegCreateKeyEx(HKEY_CURRENT_USER,
BufSubkey,
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_WRITE,
NULL,
&hk,
&dwDisp);
if (HRESULT == ERROR_SUCCESS)
{
HRESULT = RegSetValueEx(hk,
MTestValue,
0,
REG_DWORD,
(LPBYTE)&dwData,
sizeof(DWORD));
}
}
I registered the dynamic library on a terminal server and used Regmon.exe and filemon.exe to monitor the logon event on the server, and I created the registry entries inside the "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Notify\MyProjectname" subkey to register my dll.
Asynchronous = REG_DWORD 1
DllName = REG_SZ MyProjectname.dll
Impersonate = REG_DWORD 0
Logon = REG_SZ fLogonEventHandler
It appeared that the library was called at logon. But I did not seen the massage box and the user did not had in his registry the entry as it has to be.
Can anyone point me please to what I’m doing wrong?
Thanks a lot for your help.
dabayi
|
|
|
|
|
Never did the Winlogon packages, but I would say, that the messagebox is displayed on another console. And because it's waiting for OK clicking, the registry writing code is never executed.
|
|
|
|
|
Thanks a lot for your answer. It think also that the messagebox is displayed in another console. But nothing is also happened when I write the registry entries before call the messagebox. I things I have first to log on the user and then create a process with his tokon.
I will appreciate any help in this direction.
dabayi
|
|
|
|
|
Ah sorry, didn't checked the code behind the MsgBox
Yes, you're right - you cannot write to the registry as it is. That's because your'e trying to write to HKCU which is impossible in the current situation - there's no current user in context of winlogon package. You might try to use the HKCR or HKLM -that should work.
|
|
|
|
|
Thanks a lot for your help geo_m.
I get it. The problem was that I forgot to use __stdcall option to declare the exported functions.
A last question. Do u have an idea how to pass an nt service parameters?
Thanks
|
|
|
|
|
I see. For my info, writing to HKCU works in that situation?
Regarding your last question, AFAIK parameters are passed to a service just as they are to any C program. For the service, use the ServiceMain function that
you specified for your service. It has two parameters - argc and argv :
void WINAPI MyServiceMain(DWORD argc, TCHAR* argv[])
{
}
This is the same as main() in a C program:
- argc is the number of arguments.
- argv is an array of strings containing the service name and the parameters.
|
|
|
|
|
Does anyone know if there is a similar function to EscapeToCString in WTL? I have XML as a string and need to make sure that problem characters ('&', '<', '>', etc.) are converted before sending as part of a URL. My MFC version used EscapeToCString to do this, but now that we have converted to WTL, I have not been able to find anything to replace it with.
<small>Some people see things that are and ask, Why? Some people dream of things that never were and ask, Why not? Some people have to go to work and don't have time for all that ...
Author: George Carlin
</small>
|
|
|
|
|
showe wrote:
Does anyone know if there is a similar function to EscapeToCString in WTL?
Not that I know of. But you can easily port the function into using ATL's CString as it's the same string as in MFC.
If you are using VC6 (and ATL3), you can use WTL's version of CString which is compatible with MFC's implementation.
--
My name in Katakana is ヨレゲン.
My name in German is Jörgen.
I blog too now[^]
|
|
|
|
|
Isn't EscapeToCString part of ATL Server??? (yes, it's in atlisapi.h) In which case, can't you use that version? (I'm presuming you're using VC++.NET!)
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Thanks, Stuart.
When it came up in help as an MFC function, I guess I wasn't thinking it could be something common to MFC and ATL, but the file is in the mfcatl include directory. It didn't compile without a specific include of the file without MFC, so I assumed I could not use it. You know what that makes me!
Susan Howe
Some people see things that are and ask, Why? Some people dream of things that never were and ask, Why not? Some people have to go to work and don't have time for all that ...
Author: George Carlin
|
|
|
|
|
I am new to ATL/C++ and COM. I am trying to recreate VB User Controls in C++ as ActiveX controls. The ATL Composite Control is the only way I've found to do this so far.
1). I use the New Project Wizard to create a new ATL COM project with MFC support.
2). I add an ATL Composite Control with Control Points Enabled and add a Textbox and a Button.
3). Now I just want to set a member variable to the text control so I can say m_Text1.SetWindowsText("something");
4). But when I go into the Class Wizard, it asks if I want to create a class. I say yes, create a CDialog class, and can add the member variable.
5). Then, I go to the composite control, add an event handler to the button click, and it says "m_Text1" identifier is not found.
How do I add a usable member variable to a control on an ATL Class Wizard??
(I can use SetDlgMessageText, but that is not a good long term solution becuase I need access to any property of any control that I put on one of these).
And lastly, is there an easier way to accomplish this than what I am doing? I can't find a way to make a composite using the MFC ActiveX wizard.
Thanks in advance,
Matt Brown
|
|
|
|
|
Hi all!
I am trying to develp an ATL COM type library using Visual C++ 6.0 which can then be used in Visual Basic 6.0
The class hierarchy is as follows:
CoClass A ----> Main File Handle
Class B ----> Collection of type B1 objects in the file. This is returned as a property of the object A
Class B1 ----> Return type of B
I should be able to do something like this in Visual Basic:
Sub module1()
Dim hA as A
Dim hB as B
Dim hB1 as B1
Set hA = New A
hA.FileName = "C:\temp\xyz.xyz"
Set hB = hA.B
For Each hB1 in hB
Debug.Print hB1.Name 'Name is a property of B1
Next
End Sub
I tried the article "Building Rich Components using ATL COM" on this website
But it pertains more to Visual C++ 7.0
Could anyone send me a sample code of how to get around this issue?
I need it really urgently!
Regards,
Neeraj
|
|
|
|
|
Hi there!
I have a problem regarding how to expose a function-parameter as a 'xs:datetime' in a WSDL-file from a ATL-Webservice.
I know that ATL7 doesn't support this type per default - instead one should expose the function parameter as a BSTR, e.g.:
[soap_method]
STDMETHOD(TestFunc)(BSTR MyDate, BSTR* bstrOut);
- but this results in that the WSDL for the method exposes the parameter 'MyDate' as a string (as it should). Now one could just change the WSDL afterwards to convert the parameter to a xs:datetime - but this would get broken each time one recompiles - so this isn't the best option. I have looked through the MSDN-samples - but haven't (yet) found any way to do this.
I have an idea that one could 'play around' with the "[tag_name]"-attribute to build own datatypes - but I'm not that familiar with this attribute (yet).
Does anyone have an idea how to expose a function parameter as a different type than the primitive datatypes?
Best regards,
Michael B. Hansen
|
|
|
|