|
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Nice little piece of JavaScript!
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
lets see you create real blue screen ?????????????????????????????
nice try.
Aizik Yair
Software Engineer
|
|
|
|
|
Hi
I have created a new dialog project. Now I want to add that PROJECT into an exitsting project's workspace. I can do this but the dialog project outputs a .exe file. How do I change this to create a .lib file so I can link correctly??
---
|
|
|
|
|
It doesn't really work that way. You'll need to create a "Win32 Static Library" ( File | New... in Visual Studio ). Once you've done so, you'll have a library project to work with. When compiled it will build a .lib file. This project is where you'll have to create your dialog and related class. It is possible to move your existing .cpp and .h file for your dialog into a static library such as this, but doing so is a bit of a pain. You will probably have to copy resouce code (from the .rc file) to a .rc file in the static library project. Making all the connections then is a bit tedious. Once you do have this library built, you will have to change the project settings in the main project so that it knows where to find your new library. I hope this helps steer you in the right direction.
Good luck.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Hi.
I have a char * to a data buffer. What is the best way to assign data from char * into a CString object? For example:
-----
// char *myChar = new char[10];
// memcpy(myChar, "abcdefghij", 10);
// CString myString;
-----
What is the best say to insert data from myChar into myString?
Thanks,
Kuphryn
|
|
|
|
|
CString myString(myChar);
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
|
Um.. the best way is to pass the argument to the constructor, so that the string is constructed and assigned in the one go. Of course the REAL answer to the question is to avoid C style strings where-ever possible..... :P
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
|
|
ahhhh. Yeah. In my final code (working version), I had to allocate one additional byte for the null-terminator.
Kuphryn
|
|
|
|
|
Hi, I dont want the default entries in a CDialog.
Adding my own entries isn't enough:
CMenu* pSysMenu = GetSystemMenu(FALSE);<br />
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu)
Can I get rid of the default entries? I need a plain menu, is this possible?
|
|
|
|
|
Call DeleteMenu on the existing items.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
window crashed/rebooted when testing.
so what's next... creating a system menu, how? please advice.
|
|
|
|
|
i wanna define a global variable in mfc application, someone told me to use extern but that wont works. but is gives still same error "Variable already defined in project.obj"
|
|
|
|
|
First, put it in a .h file that is shared by all members (stdafx.h is a good place.) Second, if you don't put it in stdafx.h, be sure to wrap it like:
#ifndef _MY_GLOBAL_VAR
#define _MY_GLOBAL_VAR
sometype m_someglobalvar;
#endif
Lastly, you must istantiate the variable in a .cpp file (stdafx.cpp is a good place).
One suggestion, though. If you really need a global variable, consider making it a static member of a class or at least provide get/set functions for it instead of fully exposing the variable.
|
|
|
|
|
Speedy wrote:
someone told me to use extern but that wont works
They are right - you are doing it wrong.
in stdafx.h
extern int m_nGlobalsAreEvil;
in stdafx.cpp ( thanks to Matt for pointing out my typo... )
int m_nGlobalsAreEvil;
By the way, globals are evil. As has been said, static variables are a better option. In a class, do
static int m_nThisIsMuchBetter;]
If this was done in class A, you can do this:
A:m_nThisIsMuchBetter = 0;
If you don't want to do that, at LEAST wrap your global in a namespace.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Christian Graus wrote:
in stdafx.h
int m_nGlobalsAreEvil;
I think you ment stdafx.cpp
And yes, globals are evil.
|
|
|
|
|
Matt Gullett wrote:
I think you ment stdafx.cpp
Yes, I did. Thanks.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Hi,
I am sure this is an easy one, but I cannot get this information intercepted.
I have an Edit View and want to know when the user presses space whilst the left ctrl key is held down.
Is this possible?
Thanks in advance,
Simon
|
|
|
|
|
3 ways I can think of do do this:
1) Create an accelerator and handle it in your view class.
2) Overide the WM_KEYDOWN message and check for the space key and call GetAsyncKeyState (or is it GetKeyState) to see if the control key is down.
3) Overide the PreTranslateMessage function, check for WM_KEYDOWN and do step 2.
|
|
|
|
|
Hi Matt,
Thanks for the response, you put me in the right place!
I handle WM_KEYDOWN already, so I elected for option 2, and you are right to mention GetKeyState. It works when I do the following:
if((nChar == 32) && (GetKeyState(VK_CONTROL) >> 7) == -1))
{
// it happened
}
Is this how you would expect to do it?
Simon
|
|
|
|
|
I am responding to system shut down with the help of WM_QUERYENDSESSION but the problem is before i respond to this message some applications are being closed which are sitting in the Task bar tray and also some open applications in the task bar.I don't want this to happen.Is there any way to be the first in trapping WM_QUERYENDSESSION session and avoid other applications being killed.
|
|
|
|
|
You can intercept (and block) this message by installing a system-wide hook with <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/CommCtls/winui/hooks_7vaw.asp">SetWindowsHookEx</a> .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|