|
Well I have only a 5 to spend on your posts. Do you prefer a single five or five 1 s?
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
|
|
|
|
|
1 x 5 != 5 x 1 @ CP.
So, I'll take a single five, I think.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
When you change the font of a combo box, how do you get the combo box to resize itself correctly, or what is the right way to do this manually? When I send a WM_SETFONT with a new font handle nothing happens.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
You'll have to do the resizing yourself. The GetTextExtent family of APIs can help.
Jim Crafton wrote: When I send a WM_SETFONT with a new font handle nothing happens
You may need to invalidate the control window so it redraws with the new font.
Also, make sure your font handle does not go out of scope or get destroyed for the
lifetime of the control.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks. I found that the culprit was having the CBS_OWNERDRAWXXX bit set. That basically has the control do nothing when the control's font is changed. So I experimented a bit and found that if I call CB_SETITEMHEIGHT once for the selection field (wParam = -1) with my calculated height, and then again for all the items in the control, and THEN called SetWindowPos with the new height of the window (also taking into account the new height for the items) that everything worked out hunky dory. In hind sight I guess this was obvious, but it took me awhile to clue in to it.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
Cool Thanks for the update!!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yet another example of Microsoft providing all of the pulleys to do the things you want, but forgetting to install the belts that connect the pulleys together.
|
|
|
|
|
Hi. Any body could please advise on how to implement a simple c++ instruction to prevent another instance of the same program that is already running from being executed.
Many thanks
|
|
|
|
|
|
Excellent advice, it seems very well explained. Are we sure it comes from microsoft??
|
|
|
|
|
I tried but it doesn't work. For it to work you'll need to use the old syntax (/clr:oldSyntax), which is incompatible with my application which uses a static library rather than dlls.
Thanks anyway
|
|
|
|
|
|
Thanks, but it seems a bit complex for me..
Is there an alternative without having to use an object?
I'm relatively new to c++ and I haven't used objects in my program so far.
|
|
|
|
|
Well in that case you've got a lot of reading ahead of you!
Yes, you can do this without using classes, *but* the core technique outlined in the article really is the only good way to do this, as it properly deals with concurrency issues that many of the other approaches don't deal with, at least for an app that has a GUI. If you don't have a GUI then you may not need something as sophisticated.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
Here's my solution:
class MultipleInstance {
public:
MultipleInstance();
~MultipleInstance();
static bool Active();
private:
static bool _Active;
static bool _Initialized;
static HANDLE _Handle;
static MultipleInstance *_Instance;
};
static MultipleInstance _MultipleInstance;
bool MultipleInstance::_Active = false;
bool MultipleInstance::_Initialized = false;
HANDLE MultipleInstance::_Handle = NULL;
MultipleInstance *MultipleInstance::_Instance = &_MultipleInstance;
MultipleInstance::MultipleInstance()
{
if ((!_Initialized) && (this == _Instance)) {
SECURITY_DESCRIPTOR security_descriptor = { 0 };
InitializeSecurityDescriptor(&security_descriptor,
SECURITY_DESCRIPTOR_REVISION);
SetSecurityDescriptorDacl(&security_descriptor,TRUE,NULL,FALSE);
SECURITY_ATTRIBUTES security_attributes = { 0 };
security_attributes.nLength = sizeof(security_attributes);
security_attributes.lpSecurityDescriptor = &security_descriptor;
security_attributes.bInheritHandle = FALSE;
SetLastError(0);
_Handle = ::CreateSemaphore(&security_attributes,0,1,
_T("Global\\InstanceSemaphore"));
if (GetLastError() == ERROR_ALREADY_EXISTS) {
_Active = true;
}
_Initialized = true;
}
}
MultipleInstance::~MultipleInstance()
{
if (_Initialized && (this == _Instance)) {
if (_Handle != INVALID_HANDLE_VALUE) &&
(_Handle != NULL)) {
CloseHandle(_Handle);
_Handle = NULL;
}
}
}
bool MultipleInstance::Active()
{
return _Active;
}
|
|
|
|
|
Hi, many many thanks for the advice but not being familiar to oject programming I am missing some crucial bits to make it work.
In MultipleInstance.h what name should I give to:
#ifndef
#define
Is there anything else I need to specify?
In MultipleInstance.cpp I have specified:
#include <iostream>
#include "MultipleInstance.h"
Is anything else needed?
In the main cpp file:
What is the correct syntax I need to use to call the object?
Should I insert it immediately after
int _tmain(int argc, _TCHAR* argv[]){
|
|
|
|
|
I am using CFTPConection class.
While uploading file via PutFile() function I also want to display
the destianion file size i.e. data uploaded up to perticaulr instant.
I could not make the connetion for that file as it is uploding i.e. it's open for writting.
So is there any way to check how much data transferred up to perticuar time. This value amy be in number of bytes.
Or is there is any othere option rather than Putfile() which uses buffer so that I can check buffer size..
please help me for this..
Thank you so much..
|
|
|
|
|
Hai all,
Can anyone suggest me how to set a blank date as the initial value for date time picker control?
I did as per the article : http://support.microsoft.com/kb/q238077/ [^]
I am currently using VC++ 6.0 and i get the following errors:
error C2039: 'SetCustomFormat' : is not a member of 'CDateTimeCtrl'
d:\program files\microsoft visual studio\vc98\mfc\include\afxdtctl.h(39) : see declaration of 'CDateTimeCtrl'
Is there any other way to do so?
Priya Sundar
|
|
|
|
|
Hi,
The steps 1,2,3 mentioned in top may be for MS Date Time Picker Activex control and steps 1 & 2 bottom could be for the Windows Date Time Picker.
You try the steps 1 & 2 at bottom.
Thanks,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
Still it didnt work after doing step 1 and 2.
And fyi.. the if we do setwindowtext with empty text, then in that case itself we dont set a blank date, instead the the control displays the current system time with a default format.
Priya Sundar
|
|
|
|
|
Hi,
If you have not yet solved the problem, please post it as new message again.
It will be better posting your code.
It may be a programming bug or VC++.
Have you tried other styles[^]other than DTS_SHORTDATEFORMAT?
It seems there are some problem already related with Datetimecontrol: DateTimePicker Format changes from Time to Short Date[^]
Thanks,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
Hello everyone,
When we have cross-apartment call (inside one process) from ... to ...,
1. STA --> MTA;
2. MTA --> STA.
In both cases we must use either GIT (global interface table) or CoMarshalInterThreadInterfaceInStream?
If call method on destination apartment through interface pointer of component of destination apartment directly is violation (bypass the above two methods)?
(for example, sharing raw interface pointer directly in global variable and call methods on interface pointer directly)
thanks in advance,
George
|
|
|
|
|
George you've started learning COM ? Dangerous! You got rid of STL atlast? Or STL got rid of you? .
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
|
Thanks Maximilien,
Any ideas to my original question?
regards,
George
|
|
|
|