|
You will want to test your app with depends.exe, which you will probably find on your harddisk. You will probably have to install the MFC dll as a part of the deployment, for example.
You will also want to make sure what all the dependencies are, as some are not redistributable and some are standard on all Windows installations. Search for the DLL-name on MSDN.
You will also want to version check DLL:s you install, unless you enjoy creating havoc and being all-round impopular. Your installset creator (which seems to be InstallShield) will have support for this.
If you have never deployed applications before, be very, very careful when doing this.
|
|
|
|
|
I have a Visual C++ application with 2 timers. Each timer implements a piece of code that accesses a resource that may need to be shared.
In other words, there may be some overlap with the timers where the code implemented by each timer may require access to the same resource. Can each timer be thought of as a separate THREAD, where I can use some locking device to share the resource??
Thanks.
Jerry
|
|
|
|
|
No because if one timer access the resource during a lenghty process, and then the second timer fires during this time, your resource will be locked and you wont be able to access it in the function from your second timer. Thus, if you wait till the resource get's unlocked, your program will hang (because there is only ONE thread).
The functions from Timer1 and Timer2 are in the same Thread !!
|
|
|
|
|
No need to use Sync Object if you are sharing resource from your timer driven routines. Because, the application has only one message process que, the WM_TIMER messages receives arbitrary and the resource can only be accessed by one thread (main process) at a time.
If the application have more than one thread and they sharing same resources. You have to use Sync objects like CCriticalSection, CEvent, CMutex, CSemaphore etc if needs.
|
|
|
|
|
Hi All,
I am using the RegisterHotKey() function in a dll.
RegisterHotKey(hWnd,GlobalAddAtom(buff),MOD_ATL|MOD_CONTROL|MOD_SHIFT, vkKey) ;
where vkKey is some virtual key. and buff is some char string generated using system time.
and when I try to capture this event in WM_HOTKEY, none of the combination of vkKey is working , also when i press vkKey without any combination the event is not fired.
My goal is to get notification from when vkkey is key pressed with and without combination.
Thanks in Advance.
Abhishake
|
|
|
|
|
I'm using WinXP SP1, IE 6.0 SP1 etc etc and Visual 6.0 SP5.
I've imported a HTML resource named 1.htm in a dll and the attempt to display in a web browser using
res://thedll.dll/1.htm
fails.
By accident I renamed it, but starting with a letter: a1.htm.
res://thedll.dll/a1.htm
Success.
This is a bug in MSHTML.DLL (this seems to be the dll that implements the res: protocol)?
Or "This behavior is by default."
Just asking...
|
|
|
|
|
Hello dear programmers,
I want to declare a pointer to CUserSock in my CUserTalkDlg, like this:
CUserSock *m_pSocket;
But when I compile, I get this errormessage:
:\appi\usertalk\usertalkdlg.h(21) : error C2143: syntax error : missing ';' before '*'
c:\appi\usertalk\usertalkdlg.h(21) : error C2501: 'CUserSock' : missing storage-class or type specifiers
c:\appi\usertalk\usertalkdlg.h(21) : error C2501: 'm_pSocket' : missing storage-class or type specifiers
UserTalkDlg.cpp
c:\appi\usertalk\usertalkdlg.h(21) : error C2143: syntax error : missing ';' before '*'
c:\appi\usertalk\usertalkdlg.h(21) : error C2501: 'CUserSock' : missing storage-class or type specifiers
c:\appi\usertalk\usertalkdlg.h(21) : error C2501: 'm_pSocket' : missing storage-class or type specifiers
c:\APPI\UserTalk\UserTalkDlg.cpp(66) : error C2065: 'm_pSocket' : undeclared identifier
c:\APPI\UserTalk\UserTalkDlg.cpp(66) : error C2061: syntax error : identifier 'CUserSock'
So I don't know how to declare a pointer to a self derived class like CUserSock. Appearently it won't work right if I just declare in CUserTalkDlg like: CuserSock *m_pSocket
So can anyone help me please?
|
|
|
|
|
Sounds like you have not included the header file for CUserSock.
You'll need to add this to the beginning of your usertalkdlg.h file.
I Dream of Absolute Zero
|
|
|
|
|
Thanx RChin,
But when you add a CSocket-class in ClassWizard, doesn't it include automatically into CUserTalkDlg? Because that's my mainwindow. But I will check it again, I think you are right.
Thank you very very much!
|
|
|
|
|
I needed to create a custom control in toolbar of SDI application.
I creating toolbar as described in http://www.codeproject.com/docking/spnsld.asp.
When I created my control derived from CStatic all ok, but this control ignored all events (internal timer, mouse moves, clicks, etc).
I developed full-function control, derived from CWnd as described in http://www.codeproject.com/useritems/CustomControl.asp. This control reacted on all events, but I can't insert it to the toolbar - operator
if ( !m_indicator.Create ( _T ( "DISPLAY" ), "Title", WS_CHILD|WS_VISIBLE,
rect, this, ID_INDICATOR ) )
return -1;
in toolbar's OnCreate method returns -1 - toolbar doesn't create.
How I can to do this? Thanks.
|
|
|
|
|
My software prints out a calibrated tape. I would like to print it in mirror image so that when printed on film, it is the correct image when viewing it through the mylar. How do I print text in mirror image? Or is there an easy way to flip the CDC so that the rendered image will be reversed automatically?
TIA
Eric
|
|
|
|
|
Sounds like you need to use the SetWorldTransform() function. Take a look at it in the MSDN!
Roger Allen - Sonork 100.10016
Strong Sad: I am sad I am flying
Who is your favorite Strong?
|
|
|
|
|
Thanks Roger,
This is what I was looking for! However, there appears to be some kind of bug in that, although the image is properly mirrored on the display, (text and lines), when I perform a print preview, the graphics are flipped properly, but the text is no longer mirrored. Text is only rotated 180 degrees instead of mirrored. I created a SDI test app and have the code listed below in OnDraw(). It just draws a triangle with a word at the left side. When mirrored, the word is properly printed backwards on the right side of the screen. In print preview, the triangle is still correct, but the text is no longer mirrored. Any ideas?
TIA
Eric
<br />
pDC->SetMapMode(MM_TWIPS);<br />
SetGraphicsMode(pDC->m_hDC, GM_ADVANCED);<br />
XFORM XForm;<br />
::ZeroMemory(&XForm, sizeof(XFORM));<br />
XForm.eM21 = 0;
XForm.eM12 = 0;
<br />
XForm.eM11 = -1;<br />
XForm.eM22 = 1;<br />
XForm.eDx = 3000;<br />
XForm.eDy = 0;
SetWorldTransform(pDC->m_hDC, &XForm);<br />
<br />
pDC->MoveTo(500, -300);<br />
pDC->LineTo(1600, -100);<br />
pDC->LineTo(1600, -1200);<br />
pDC->LineTo(500, -300);<br />
pDC->SetTextColor(RGB(0,0,0));<br />
<br />
CFont num_font_upper;<br />
num_font_upper.CreateFont(.4 * 1440 , 0, 0, 0, FW_NORMAL, FALSE, FALSE, 0,<br />
ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS | CLIP_LH_ANGLES,<br />
DRAFT_QUALITY, VARIABLE_PITCH |FF_SWISS, "Arial"); <br />
CFont *pFont = pDC->SelectObject(&num_font_upper);<br />
pDC->TextOut(500,-300, CString("test"));<br />
pDC->SelectObject(pFont);<br />
|
|
|
|
|
::CryptGetHashParam(hHash,HP_HASHSIZE,NULL,ssize,0);
it does not return the size of hash to ssize =((
|
|
|
|
|
DWORD dwHashSize = 0;
DWORD cbSizeOfHashSize = sizeof(DWORD);
::CryptGetHashParam( hHash, HP_HASHSIZE, &dwHashSize, &cbSizeOfHashSize, 0 );
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hello!
I have a class which has two constructors. One is a default and the other is the one I expect to use. In my class I have an COleDateTime member which I want to set in my constructor. I may need several constructors so I set most values in my default constructor and call my default constructor from my other constructors - I think this is OK yes?
But when in my program I create my object like this:
CMyObject *pMyObject = new CMyObject("My Object");
Debugging shows it calls the constructor but the COleDateTime m_Constructed member is not set to the current time. If I set it in the called constructor it is set as I want. Why is it not set if I call the default constructor from within my other constructor? I want it to work like this so that if I have more constructors I can set my members common to all constructors in the default constructor and call the default constructor from each of the other constructors.
Thanks. My code is below as an example:
class CMyObject
{
public:
CMyObject();
~CMyObject(){}
CMyObject(const char *title);
private:
CString m_Title;
COleDateTime m_Constructed;
};
CMyObject::CMyObject()
{
m_Title = "";
m_Constructed = COleDateTime::GetCurrentTime();
}
CMyObject::CMyObject(const char *title)
{
CMyObject();
m_Title = title;
}
|
|
|
|
|
My recommendation would be to create a private member function to handle those common instructions. Then call it from each version of your class's constructor. I don't honestly know why your situation doesn't work.
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
In a nutshell, you can't call a constructor from a constructor of the same class if you want to initialise the this object.
In your CMyObject::CMyObject(const char *title) constructor, the line CMyObject(); doesn't call CMyObject::CMyObject() on the this object. Instead it calls CMyObject::CMyObject() to initialise a local, temporary object. This is then destroyed as it goes out of scope when construction ends.
So bneacetp is right when he suggests providing an initialisation function.
"Oh, I'm sick of doing Japanese stuff! In jail we had to be in this dumb kabuki play about the 47 Ronin, and I wanted to be Oshi, but they made me Ori!"
|
|
|
|
|
Sir,
I am trying to find a unique machine of the computers listed in my network.
I can do it in 2 ways:By obtaining
1.IPAddress
2.MAC Address
Since IPAddress is subject to change and MAC address changes if there is change in the hardware configuration.
So the only way is to create a GUID of that machine.
The question is how one should go about in creating GUID.
I mean what are the functions should I use?
Is there any API?
I know that 2 utilities like GuidGen.exe and uuidGen.exe create unique GUIDS.
Pls guide
Regards
|
|
|
|
|
To programmatically create a GUID try calling CoCreateGUID() which can be found in objbase.h.
<code>
HRESULT CoCreateGuid(GUID* pguid);
</code>
Regards,
|
|
|
|
|
I hate to say this, but I fail to see how a GUID will uniquely identify a machine. In the past, GUID's were based on the MAC address. For security reasons, this is no longer true. As far as I know, it's based off the time and random values.
--
Joel Lucsy
|
|
|
|
|
Hi Dear,
How r u?
I use this code..but unable to set font in vc++ dialog box.
CStatic ArrayCaption;
ArrayCaption.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(10,i*17,450,i*17+50),this,123);
ArrayCaption.SetWindowText("Sumit Kapoor");
I use
ArrayCaption.SetFont(&cFont1)
but that is not working
Any Hint please..
Thanks
---Sumit Kapoor---
|
|
|
|
|
Declare the fonts of the CFont type that you need in your dialog's class. Then in your class's OnInitDialog() function, define your font's style and then:
GetDlgItem(<controlIDHere> )->SetFont(<fontnamehere> );
That should do it.
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
Hi..thanks for reply....
I create font by using this code:
CFont font;
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT)); // zero out structure
lf.lfHeight = 22;
// request a 12-pixel-height font
strcpy(lf.lfFaceName, "Arial"); // request a face name "Arial"
font.CreateFontIndirect(&lf); // create the font
//then create
CStatic ArrayCaption;
ArrayCaption.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(10,17,450,65),this,123);
ArrayCaption.SetWindowText("Sumit Kapoor");
// mine try...
//ArrayCaption.SetFont(&font)
// then your hint one but not working
GetDlgItem(123)->SetFont(&font);
you can copy paste this code & check..if doubt...
Thanks for help..bye
---Sumit Kapoor---
|
|
|
|
|
font is not exactly a member of your class, is it?
Do as suggested and create a CFont member variable. GetDlgItem will do the same as the direct reference ArrayCaption , so you should keep the ArrayCaption.SetFont - but have the class member as i parameter, of course. Remove SetDlgItem .
|
|
|
|
|