|
|
If you create a MFC SDI or MDI application with the wizard, some time at step 4 (i'm not sure) you can click the advanced button and define custom file format for your application. Then the wizard will crete a REG file in the project directory. You can have a look at it and see how they do it.
Best regards,
Alexandru Savescu
|
|
|
|
|
I have Added the accelerator keys to a dialog box. When I run the application I don't see the underline under the leter. Except when I hold down the ALT key then its displayed. I am running Windows 2000. I noticed it works fine under Windows ME. Anyone know how to enable this to show always at runtime.
Thanks
|
|
|
|
|
this is an option in the OS itself.. go to control panel, display, effects tab, one of the check boxes says 'Hide keyboard navigation indicators until i use the Alt key'
so if they don't show its the settings
hope that helps
-dz
|
|
|
|
|
Thanks, do you know how to display the underline even though is disabled in the control panel. Just like in Word, its always displayed.
|
|
|
|
|
Can I center text in a Listbox? I know I can choose left or right, but what about center?
I'm not using MFC by the way
Thanks for any reply
|
|
|
|
|
Make it owner-draw!
I don't know excactly in Win32 API but you have to make it owner-draw!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
Hello People,
Is there an equivelant function in C++ (or c) to the Visual Basic Function "Asc".
For example, converting a given character to its ASCII code?
In VB: integer = Asc("A")
Thanks,
Frank
|
|
|
|
|
int hello = (char)'a';
In C++ you can do mathematical operations on chars, you can say
char b = 123 or
char b = 'a' .
|
|
|
|
|
Cool, thanks!
Frank
|
|
|
|
|
Just curious...what kind of projects have a "common" folder? if you want to include some static libraries with your project, how do you include them? I amlooking at my project and I don't see a "common" folder, yet that's where it appears that I should be putting my stuff...
any ideas?
|
|
|
|
|
i put each static lib in its own folder. that way, i can get to it from any workspace/project that needs to.
-c
Cheap oil. It's worth it!
|
|
|
|
|
What does it mean when you try to link to a static library and you get this error:
LINK : warning LNK4098: defaultlib "MSVCRTD" conflicts with use of other libs; use /NODEFAULTLIB:library
Debug/test.ocx : fatal error LNK1169: one or more multiply defined symbols found
|
|
|
|
|
It means that you are linking your code with MSVCRTD and some other version of the c++ libraries that define the same functions. To get around this Open the link tab of the project settings for your executable and select the input category and then put MSVCRTD in the Ignore libraries edit box.
John
|
|
|
|
|
Hi,
I'm making a dll which needs to export classes, but as this is going to be used to make compiler independant extensions, I would like to keep the code as platform independant possible, so does anyone know a way of doing this:
class __declspec(dllexport) CFoo which would work on any compiler. __declspec(dllexport) according to the MS documentation seems to be microsoft specific. If possible I would like to keep away from writing into the .DEF file, but if I have to does anyone know how to do it right?
Thanks for your time...
England 1 : Sweden 1
We don't stand a chance against Argentina!
Joel Holdsworth
|
|
|
|
|
#ifdef _MSC_VER
#if EXPORTING
#define DLLAPI __declspec(dllexport)
#else
#define DLLAPI __declspec(dllimport)
#endif
#else
#error "define a declspec for this compiler
#endif
class DLLAPI CFoo
This would be enough for you.
That being said. I think DEF file is much better way to export then using __declspec(dllexport). You should however use __declspec(dllimport) so that the linker optimizes the stub linkage.
|
|
|
|
|
Rama Krishna wrote:
I think DEF file is much better way to export then using __declspec(dllexport).
How do you export an entire class then with a .DEF file?
Best regards,
Alexandru Savescu
|
|
|
|
|
Get all the decorated names of the public methods of the class and put them in the .DEF file. MFC does the same way.
|
|
|
|
|
Hi!
I have written an NT Service to monitor an application execution.
The NT Service detect properly when the application crashes (deadlock).
In order to reboot the system I am using the API function ExitWindowsEx to reboot the system, but it doesn’t work very well. As a matter of fact, when I call this API function the system shows a blue screen and stay in this situation timelessly.
The code that I am using (the shut down example from MSDN) is show below (I guess I have got the right privilege).
Does anybody know how can I make the system reboot properly?
Thank you very much for your attention.
Sergio
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
// Get a token for this process.
if (!OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
error("OpenProcessToken");
// Get the LUID for the shutdown privilege.
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
&tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1; // one privilege to set
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
// Get the shutdown privilege for this process.
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
(PTOKEN_PRIVILEGES)NULL, 0);
// Cannot test the return value of AdjustTokenPrivileges.
if (GetLastError() != ERROR_SUCCESS)
error("AdjustTokenPrivileges");
// Shut down the system and force all applications to close.
if (!ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCE, 0))
error("ExitWindowsEx");
|
|
|
|
|
BTW, Welcome Sergio! I saw your name as a new member!
For your problem, I think you didn't get the right privilege, try
adding a Messagebox or something in your app to verify that.
I am pretty sure you didn't obtain the privilege.
Good luck!
One good thing about getting older, you don't lose the ages you've been!
|
|
|
|
|
Hi Sergio ! Welcome to CP !
I don´t know if this would help but try to change the ExitWindowsEx stuff for this:
InitiateSystemShutdown(NULL, NULL, 0, TRUE, FALSE);
Mauricio Ritter - Brazil
Sonorking now: 100.13560 Trank
The alcohol is one of the greatest enemys of man, but a man who flee from his enemys is a coward.
|
|
|
|
|
G'Day Sergio,
A while ago I wrote a NT Service that would reboot my pc. As suggested by Mauricio I used InitiateSystemShutdown. If you want the pc to reboot rather than shutdown then the last parameter should be TRUE rather than FALSE in Mauricio's example.
With respect to priveleges - SE_SHUTDOWN_NAME is the only one that I have used.
Good Luck
Richard.
|
|
|
|
|
If you are a VC++ Guru and knowz how to create XML based IE Toolbars, then leave a comment here with your email and sample work url's
We have lot of orders of IE Toolbars. Also, let us know how much do you charge per toolbar.
Thanks..!!
|
|
|
|
|
http://www.codeproject.com/atl/rbdeskband.asp
This article is a wazard for creating deskbands.
http://www.codeproject.com/tools/codeprojectsearchbar.asp
The codeproject IE bar is a nice example of how it all works.
I don't know about how XML will work into that, but this is what CP has to offer!
With time we live, with money we spend!
Joel Holdsworth
|
|
|
|
|
Hi
I'm new to c++ and need a little help loading dll's at run-time. I found a bit of code on msdn, edited it and crossed my fingers but it didn't work . Can anyone see why?
-------------------------------------------------
int CMainFrame::LoadPlugins()
{
typedef UINT (CALLBACK* LPFNDLLFUNC)();
HINSTANCE hDLL[5]; // Handle to DLL
LPFNDLLFUNC lpfnDllFunc[5]; // Function pointer
UINT uReturnVal = 0;
CString PluginName[5] = {"plugin1.dll", "plugin2.dll"};
for (int i = 0; i != 5; ++i)
{
// Use Plugin name to load plugin
hDLL[i] = LoadLibrary("Plugins\\" + PluginName[i]);
if ((hDLL[i]) != NULL)
{
AfxMessageBox("Loaded Plugin : " + PluginName[i]);
lpfnDllFunc[i] = (LPFNDLLFUNC)GetProcAddress(hDLL[i], "Load");
if (!lpfnDllFunc[i])
{
// handle the error
AfxFreeLibrary(hDLL[i]);
AfxMessageBox("Couldn't Execute Plugin : " + PluginName[i] + ". No such function.");
}
else
{
// call the function
uReturnVal = lpfnDllFunc[i]();
AfxMessageBox("Function Called");
}
}
else
{
if (PluginName[i] != "")
AfxMessageBox("Couldn't Load Plugin : " + PluginName[i]);
}
}
//if a return value was set at least 1 plugin loaded
if (uReturnVal)
return 1;
}
-------------------------------------------------
It will load the dll but not execute the function.
Any help would be appreciated
Thanks
|
|
|
|