|
Rajesh R Subramanian wrote: I love it.
The problem is yours.
(just kidding).
Rajesh R Subramanian wrote: I'll want you guys to sit in a row and write an ActiveX control from scratch in plain C++. I'll give you paper towels to wipe that sweat and blood while you do the dodgy thing
ATL , IMHO is much better for the above task. We can even write the ActiveX as you proposed: we've Jeff Glatt's wonderful article series on our side [^].
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
|
|
|
|
|
|
Rajesh R Subramanian wrote: What are you doing answering C++ queries on a sunday, you addict.
Five for this.
Rajesh R Subramanian wrote: Now, I'll wait for this book:
Writing ActiveX components with nothing but the 8086 assembler - by CPallini.
Five.
Rajesh R Subramanian wrote: BTW, Jeff Glatt's series rocks.
Five.
Unfortunately I can vote your post only once.
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
|
|
|
|
|
CPallini wrote: Unfortunately I can vote your post only once.
So you can consider mine.
OK,. what country just started work for the day ? The ASP.NET forum is flooded with retarded questions. -Christian Graus
Best wishes to Rexx[^]
|
|
|
|
|
OK. I'm considering...
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
|
|
|
|
|
Now, I must add a separate reply for every sentence I write to you. That way, I'll gain lotsa fives.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
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!"
|
|
|
|