|
I register my user messages with ::RegisterWindowMessage().
I fail to identify a technique to deregister such a message - will it automatically be free'ed when the application goes, am I blind and fail to see the appropriate function in MSDN, or is Windows running out of user message codes eventually?
Mind you the OS is likely to die on me before this happens, but the question remains...
Any clues?
TIA,
Bernd
|
|
|
|
|
You should only use RegisterWindowMessage() to send messages to another application running in a different process. For internal window message communication you shouldn't really use this. But don't worry if you do when your application shuts down (providing another application hasn't registered the same message) the operating system will gradually release its mapped resource on this string.
If you are just doing this from within your own application have a look at ON_MESSAGE in MSDN. This is the correct way to deal with custom messages from within your application (unless of course you want to pass messages between GUI threads which would use ON_THREAD_MESSAGE)
|
|
|
|
|
Thanks for the clarification on the resource management issue.
I wonder, though: why is it that I shouldn't use this for inter-thread communication (not GUI threads, but regular workers) within a process?
TIA,
Bernd
|
|
|
|
|
Hi All,
My task is to develop a some editor,roughly speaking like vc++ IDE.I wud like to incorporate Autocompletion,Syntax coloring,cut,copy and paste features,etc to my editor.Is there any tool available other than Scintilla,so that u can use that tool directly.I have gone through the Scintilla site.Finally what I have come up after seeing that site was its not easy to use that tool.Let me know,any one used this tool or any other tool.
Thanks in Advance,Rama.
Deepa D.
Senior Developer.
|
|
|
|
|
I want to format a date according to the system language, for example I want the month name to be displayed according to the system language chosen.
CString strResult;
COleDateTime dMyDate;
dMyDate.SetDate(2003, 12, 3);
strResult = dMyDate.Format("%d %B, %Y");
The result is as follows: "12 December, 2003" but what I want is to show the month name in another language.
Any ideas?
Daed
|
|
|
|
|
Have a gander at the NLS API (e.g., GetLocaleInfo() , GetDateFormat() ).
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Yes i tried GetLocaleInfo to get the locale language.
I set the locale language to be English and the date/time language to be the local language. I needed this because i only want the month name to be displayed in the local language and the numbers and date order to be displayed in English. Most of the languages worked fine except the Right-to-Left languages like Arabic and Hebrew, ??? are displayed instead. What can i do?!
TCHAR strLanguage[256];
GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLANGUAGE, strLanguage, sizeof(strLanguage));
CString cstrlastLocale;
#ifdef _UNICODE
cstrlastLocale = (CString) _wsetlocale(LC_ALL, _T("English"));
_wsetlocale(LC_TIME, strLanguage);
#else
cstrlastLocale = (CString) setlocale(LC_ALL, _T("English"));
_wsetlocale(LC_TIME, strLanguage);
#endif
|
|
|
|
|
The app I want to create is very simple : just a window displaying an image, which is grabbed from a camera.
To be more clear : there is several steps : acquisition, compression and display to the screen.
So I create a simple MFC dialog (jut one window without control button except one alone). I include grabbing and compressing steps in the OnInitDialog, and also the display function.
I want to process this until the user pushes a button stop.
The problem is that (when I see it in the Debug mode) all is well done, until the image to the screen refresh.
Does anyone know why ?
Thanks,
|
|
|
|
|
Are you talking about a single image displayed like a photo, or a continuously changing image like something grabbed from an active webcam?
And what exactly happens when the problem occurs? When the image to the screen refreshes, it doesn't display properly? Or it's all black? Or what?
Kelly Ryan
|
|
|
|
|
It's a continuously changing image, grabbed from a camera.
When I run the program, the 1st image is well shown. After the image file changes (same name, etc), but the window always shows the first image.
|
|
|
|
|
What I'd probably do is create a global image file that contains the imagine you want to display, and run a loop that just keeps redrawing that image maybe 30-50 times a second. When you grab your next image just set it to your global and then it'll automatically redraw. Otherwise you should be able to just clear the screen and re-blit when the image file changes.
Kelly Ryan
|
|
|
|
|
|
I've derived my propertysheet classes from a class, which has implemented RemovePage as:
void cdxCDynamicPropSheet::RemovePage( cdxCDynamicPropPage & rPage )
{
ASSERT(rPage.m_pSheet == this);
rPage.m_pSheet = NULL;
}
but there's no implementation for CPropertySheet::RemovePage(int nPage)
I'd like to know how I can implement that.
|
|
|
|
|
mfc_surfer wrote:
but there's no implementation for CPropertySheet::RemovePage(int nPage)
Have you looked in DLGPROP.CPP? It's implemented there.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hello , ive got the following member function pointer problem noting that all my search result on the net wasn't useful at all.
class MyClass
{
Anotherclass MyObject;
void Function1();
void FunctionNeededPointer(Float*,int,int);
};
void MyClass::Function1()
{
//Here i need to pass a pointer of a function to the
//following function belonging to MyObject
//void Anotherclass::Function(void *aFunction,void
// *callingObject=NULL)
//so i tried this and didn't work
void (MyClass::*pToFunction)(float*,int,int)
= &MyClass::FunctionNeededPointer;
MyObject.Function((void*)pToFunction);
//oops error: cannot convert from void(__thiscall
// Myclass::*)(float*,int,int) to void*
//So had to make that function static and worked but
//it ended up that every thing in MyClass was converted
//to static which is not a nice solution at all
//so i'm wondering if someone could help with this
//problem
}
|
|
|
|
|
With classes you have two options:
1) make function static, so that all objects of the type MyClass reference the same static function. In this case you can use MyClass::FunctionNeededPointer
2) Function you are trying to pass is not static.
To pass function pointer you should use something like "this->FunctionNeededPointer", since function obviously has very little meaning outside of class scope...
3) Here is how you can define function type
typedef void (MYFUNCTION)(float*,int,int);
void Function(MYFUNCTION *p);
{
Function(&this->FunctionNeededPointer);
}
Brian
|
|
|
|
|
Thanks for your reply, but i forgot to mention something that i haven't got any control on the function
Function(void *aFunction , void *callingObject=null) as it came with a header file of a library and i've got to use it as is, besides when i try to use
&this->FuctionNeededPointer it gives the following error
'&' : illegal operation on bound member function expression
|
|
|
|
|
i develop almost all of programs under win95 because we can sell to more customers.
i don't think there is any important reason to develop under xp, 2k etc.
if you use xp, 2k..., do you find some significant contributions of those OS related to C++?
includeh10
|
|
|
|
|
includeh10 wrote:
i develop almost all of programs under win95 because we can sell to more customers.
Does this mean you run your Visual C++ and tools under Win95 as well!
includeh10 wrote:
i don't think there is any important reason to develop under xp, 2k etc.
XP and Win2k and NT 4 are much more stable for developing on. If you app crashes in 9x then it is possible that it'll bring the entire OS down. For me this meant time consuming reboots which is why I did/do all my developing on NT based OS.
Testing apps to make sure they run on 9x is fine, developing on 9x is a little silly if you ask me.
Michael
Blue canary in the outlet by the light switch
Who watches over you
Make a little birdhouse in your soul - They Might Be Giants
|
|
|
|
|
Michael P Butler wrote:
Testing apps to make sure they run on 9x is fine, developing on 9x is a little silly if you ask me.
I agree. The two contract jobs I worked on prior to my current one required me to develop on Windows 95 and 98 respectively. Both were disastrous for developing on, re: crashes and frequent reboots.
Of course, with the latest VC++ you can't develop on Win 9x anyway.
Kevin
|
|
|
|
|
1. Your point one is invalid since there is nothing that precludes you from developing on NT and then running on 9x.
2. NT is a much better development environment since it doesn't suffer the stability issues of 9x.
3. C++ isn't tied to an operating system. It is a question of environment quality. 9x contributes nothing to C++.
There is NO reason to develop on 9x. It doesn't provide you with a wider install base since NT program can run on 9x as long as you don't take advantage of the advanced functions. There is even UNICODE support for 9x via MSLU.
9x is not a development quality operating system.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Two reasons to work on 2K / XP.
1) more stable
2) Alot more GUI controls you can use. (you can also incorporate DirectX if you are doing Sound or Video Editing tricks)
|
|
|
|
|
NT = 2K = XP
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Over the years I have developed on all the operating systems. There are only 3 things I can tell you:
1) Years ago I used to have the believe that if you could get an app to compile on old 95/98 machines it would have a better chance of working without modification on newer OS (NT). You would be supprised at how many developers ignore the footnotes for a function at the end of the MSDN literature that specify what operationing systems support them only to get burned later. Lately though I have decide to develop on the latest OS because of the next paragraph. Read on...
2) I have noticed that an application developed on 2000 using VC7 produces a GUI appearance that looks the same on 2000 and XP (that is the old style buttons etc.). Whereas the same application developed on XP will have the newer buttons (mouse hover hite etc..)and interface appearance when viewed on XP and the older but standard appearance on 2000.
3) Visual studio.Net won't work on anything older than 2000 so you might as well forget the older OS for developing.
Art
|
|
|
|
|
I want to programmatically control the mouse cursor- like they do in all those playback demos and stuff like that. The mouse cursor should not only move to the coordinates defined in the program, but also click.
Secondly, how can I do the same for keyboard? I mean, I should be able to issue keyboard key commands from a program.
Thanks for your help.
http://www.atanveer.com
|
|
|
|