|
«_Superman_» wrote: But mutually exclusive check boxes can handle "zero or one" functionality which is not possible with radio buttons.
Uh, yeah, it is. You add another radio button, label it "none of the above", and give it the same meaning in your program that the somewhat-less-than-obvious fewer than the maximum number of checkable checkboxes are checked state would have had, should you have been mad enough to actually implement such an atrocity.
Now you have a finite number of states, all of which are explicitly named, and all of which can be selected with a single click. Radio buttons - learn to love 'em.
|
|
|
|
|
Okay.
In VC++ 6.0, take a look at the properties dialog of a button.
You will see 2 check boxes for Icon and Bitmap .
So if this is an atrocity, how better would it be to do it in that space with radio buttons?
«_Superman_»
|
|
|
|
|
Space constraints? Combo box!
|
|
|
|
|
Hi All,
I have created ATL DLL with function Add(int var1, ibt var2), also registered dll using regsrv32 command, and I created another MFC project so plz tell me how to use this function of DLL in MFc project.? which files to include in new project?
|
|
|
|
|
#import the dll and then follow the steps underneatch
CoInitialize(NULL);
HRESULT hr = S_OK;
IITestObj* pTest = NULL;
hr = CoCreateInstance(__uuidof(ITestObj),NULL,CLSCTX_ALL,__uuidof(IITestObj),(void**)&pTest);
if(SUCCEEDED(hr))
{
pTest ->Add(5,10);
}
else
{
MessageBox("Failed to get the component",NULL,MB_OK);
CoUninitialize();
}
CoUninitialize ();
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
What is IITestObj* pTest = NULL; in your case?
In mine case , IITestobj is class, but compiler is giving error undeclared identifier,
I have imported DLL at start.
|
|
|
|
|
it is an interface pointer. ITestObj is the Atl Simple Object that I added using the class wizard.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Hi below code may help you,
#import "../MathOperations.dll" named_guids
using namespace MathOperationsLib;
Create instance for dll
HRESULT hresult;
CoInitialize(NULL);
IOperationsPtr ptr;
hresult=CoCreateInstance(MathOperationsLib::CLSID_Operations,NULL,CLSCTX_INPROC_SERVER,MathOperationsLib::IID_IOperations,(LPVOID *) &ptr);
if(FAILED(hresult))
{
MessageBox(L"Creation Failed",0,0);
return;
}
LONG Z;
ptr->AddNumbers(4,6,&Z);
CoUninitialize();
|
|
|
|
|
Hi,
I have a application that we installing on user's m/c in Admin credentials. But whenever user logs in as a normal user (without Admin credentials) we are trying to update the patch, which will replace some components (exe,dll) in "Program Files" directory. Since user doesn't have Admin credentials he will not be able to do so.
I woould like to know is there any way by which normal user will be able to update these patches, which will not require any Admin credentails.
Thanks
SNI
|
|
|
|
|
You can use remote tools like windows SMS, or remoteexec to push your dlls across the network.
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
I have this code as part of my DllRegisterServer() method:
TCHAR szPath[MAX_PATH];
GetModuleFileName ( g_hinstThisDll, szPath, MAX_PATH );
TCHAR * pdest = _tcsrchr(szPath, _T('\\'));
TCHAR szTemp[MAX_PATH];
_tcsncpy(szTemp, szPath, (size_t) (pdest + 1));
_tcscpy(szPath, szTemp);
_tcscat(szPath, "My.tlb");
When I try to use RegSvr32.exe to register the DLL, I get a message that Windows DEP (Data Execution Protection) has stopped the execution of RegSvr32.exe.
I replaced the above code segment with a constant assignment (snippit follows) and RegSvr32.exe completed successfully:
TCHAR szPath[] = _T("C:\\SomePath\\My.tlb");
I copied the problem code into the main() of a console application and outputted the result, which yielded the intended string. (The console application wasn't under Windows DEP.)
From what little I know of DEP, this code must be doing something with protected memory in order to trip it.
I don't usually use this style of string manipulation - I generally use CString's or .NET's String class. Can anyone see what I'm doing wrong here?
Any help would be greatly appreciated.
MZR
|
|
|
|
|
Your code has a bug.
Mike the Red wrote: _tcsncpy(szTemp, szPath, (size_t) (pdest + 1));
What do you expect here as the count parameter?
It is taking the value as an address plus 1.
This is going to be a very big value.
Another example of why typecasting must be avoided.
I wonder how it worked in a console application.
I tried it in a console application and it gave me the DEP error.
«_Superman_»
|
|
|
|
|
Thanks for the quick response, Superman!
That code you quoted (_tcsncpy(szTemp, szPath, (size_t) (pdest + 1)); ) was copied from the MS help file's example code for _tcsrchr . To be honest, I copied it without careful examination.
What I was expecting for the the count parameter was the index of the last \ in the file path.
GetModuleFileName returns the full path to the .DLL, say "c:\some path\This.DLL". I'm trying to extract the path and change the filename to the type lib's name, for instance "c:\some path\My.tlb".
Now that I re-read the helpfile on _tcsrchr , "Returns a pointer to the last occurrence of c in string, or NULL if c is not found", I actually have no idea how I would make use of this function.
At this point, I would probably manually iterate through the filepath string to find the index of the last \, then pull a substring and concatenate the type lib's filename. Is there a more efficient way to do this with the built-in string manipulation routines?
Thanks again for your help!
MZR
|
|
|
|
|
You must use _tsplitpath .
In the dir parameter you will get the path minus the filename.
Now you can concatenate the .tlb filename using _tcsncat_s .
«_Superman_»
|
|
|
|
|
I am currently writing an application using C++ and MFC. In this application I would like to be able to convert a string stored in an object of type CString to a C++ int. This string represents a signed integer. It seems to me that there should be a member function of the class CString to do this, but I have been unable to find such a member.
Thanks
Bob
|
|
|
|
|
I don't think CString should have a member function to do conversion to int.
CString is meant for dealing with strings.
You can convert using _wtoi like so.
CString cs = L"25";
int i = ::_wtoi(cs);
«_Superman_»
|
|
|
|
|
BobInNJ wrote: but I have been unable to find such a member.
because there is no such member.
you can also use _ttoi()
Regards,
Sandip.
|
|
|
|
|
See also StrToInt function [^].
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]
|
|
|
|
|
The easiest way is to search Google for "CString to int".
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
How can I distinguish between a hardware CDROM unit and a virtual one? I tried GetDriveType() but it doesn't ditinguish a DaemonTools Virtual unit from a real one.
In VC++ please...
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Erm, that's kinda the POINT of things like daemontools. They spend a lot of effort to NOT be distinguishable. As far as the operating system is concerned it is a CDROM drive. Only at the deep driver level does it make a detour to look at a file on the hard disk, rather than a physical cd.
Iain,
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Thanks! It's over my actual possibilities.
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Such applications *normally* use a rootkit[^] to show itself to the OS as a Optical disk drive (or whatever it wants to appear to be). So, you'll have to write application that will detect a rootkit and find if it actually is hiding itself to provide a virtual disk drive capability.
There may be some X application that may not be using a rootkit. So, I don't see a "generic" approach to figure out this stuff.
A crude way is to note down the registry entries and folders all such applications create and look out if there's anything of that present in the machine. But if there were multiple drives (including actual optical drives), ...
Yours is an ambitious project, sir.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Thanks! It's over my possibilities.
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
I have to show the Pointer position on the Windows XP screen without over-write any information on the screen (like the mouse without using any GUI). Is there any way to do that or I have to use interrupt 33h? If in the latter case, how I do that in VC++ codes to call interrupt 33h?
Thanks for any help
modified on Monday, February 9, 2009 3:58 PM
|
|
|
|