|
|
thanks
-----------------
conglt
|
|
|
|
|
|
thanks
-----------------
conglt
|
|
|
|
|
Hi all
Can someone tell me steps I need to take in order to change my programs default MFC icon to the icon I want ?
Thanks.
I am having some strange problems, when simply rename the icon i want to IDR_MAINFRAME
|
|
|
|
|
where u see in the code LoadIcon and IDR_MAINFRAME change the IDR_MAINFRAME to your desired icon (use the MAKEINTRESOURCE maco if it an icon from the resources)
hope it helps
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi big_denny_200
Example
HICON h=LoadIcon(AfxGetApp()->m_hInstance,(LPCTSTR)IDI_ICON1);
SetIcon(h,0);
|
|
|
|
|
Hi friends,
1)What is user of global static variables.
2) can i user those vars in other files with extern keyword?
Vikram S
|
|
|
|
|
vikrams wrote: 2) can i user those vars in other files with extern keyword?
it has an internal linkage ie its scope is in the translation unit where it is defined.
vikrams wrote: 2) can i user those vars in other files with extern keyword?
u have to remove the static keyword
never say die
-- modified at 5:04 Monday 17th April, 2006
|
|
|
|
|
Can u please put some more light on "translation unit" concept in terms of source & header files?
|
|
|
|
|
Hi Friends,
After some analysis I got following answers
1) When u compile your files(any type of project). each cpp/cxx/C file treated as separate translation unit
2) Object file will be created for each one of them
So for static variables
1) If the static variable in declared in some other cpp/cxx/c file, U can not access it ( using extern keyword) as it becomes as private for that file/translation unit.
2) If u declared global static variable in header file then each translation unit will get copy of it and also your final exe will contain mutiple instances of that global variable
for each file contents (means the functions/classes... inside file ).
Experts.. Please correct me if there is any incorrectness.
VikramS
|
|
|
|
|
Hi Friends,
After some analysis I got following answers
1) When u compile your files(any type of project). each cpp/cxx/C file treated as separate translation unit
2) Object file will be created for each one of them
So for static variables
1) If the static variable in declared in some other cpp/cxx/c file, U can not access it ( using extern keyword) as it becomes as private for that file/translation unit.
2) If u declared global static variable in header file then each translation unit will get copy of it and also your final exe will contain mutiple instances of that global variable
for each file contents (means the functions/classes... inside file ).
Experts.. Please correct me if there is any incorrectness.
VikramS
-- modified at 6:40 Monday 17th April, 2006
|
|
|
|
|
Hi,
Does any have idea of "Timing Diagram"..i want to implement it,pls help me out.
thanks in before
James rocky
|
|
|
|
|
RockyJames wrote: Does any have idea of "Timing Diagram"..
This could be most anything. Please elaborate.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hey sorry to repost, but no one seems to pay attention to posts that have some answers.
I am strying to take a STL string that I have and use it WIN32 API calls that require a LPTCSTR ( I think this is a const tstring). Anyways, I have tried the following header code, and it compiles, but I have no idea how to use the " typedef std::basic_string< TCHAR > tstring; " code... basically I want to do the following:
string stlStr;
LPTSTR sillyMicrosoftString = stringToLPTSTR(blah);
How can I make this work?
//header code in my file
#include <windows.h>
#include <stdio.h>
#define NULL 0
#include "LogFiles.h"
#include "TestPrint.h"
#include <string>
#include "TestPrint.h"
#include <iostream>
#include <conio.h>
typedef std::basic_string< TCHAR > tstring;
-- modified at 3:10 Monday 17th April, 2006
|
|
|
|
|
you can convert string to "char *" first,then convert "char *" to LPTSTR.
|
|
|
|
|
Could you show me an example please?
Thanks!
|
|
|
|
|
string strA = "test string";
char *pTemp = (char *)strA.c_str();
TCHAR * s1=(TCHAR *)s;
|
|
|
|
|
That doesn't work at all!
So I have the need to turn STL strings into LPTSTRs, and then take LPTSTRs back into strings...
Please help me solve this problem.
Thanks!
|
|
|
|
|
|
I have a class that can draw picture in dialog box using the following code:
<br />
void CDialogbox::OnPaint()<br />
{<br />
CPaintDC dc(this);
CRect m_rect;<br />
GetWindowRect(m_rect);<br />
m_myclass.Draw(dc,m_rect);
<br />
}<br />
These codes works fine as I just anticipated. But when I want to use memory DC for caching, it did not work:
<br />
void CDialogbox::OnPaint()<br />
{<br />
CPaintDC dc(this);
CDC m_memdc;<br />
m_memdc.CreateCompatibleDC(&dc);
CRect m_rect;<br />
GetWindowRect(m_rect);<br />
m_myclass.Draw(dc,m_memdc);
dc.BitBlt(m_rect.left,m_rect.right,m_rect.Width(),m_rect.Height(),&m_memdc,0,0,SRCCOPY);
}<br />
Does anyone can help me?
Lisoft
|
|
|
|
|
m_myclass.Draw(dc,m_memdc); // First draw to memory DC???????????
Why parameter 2 is a DC
-----------------
conglt
|
|
|
|
|
The problem is you did not selected any bitmap to the memdc.
CreateCompatibleDC will create a dc with 1x1 pixel wide bitmap. So you have to create a bitmap also. See the example.
CPaint dc( this );
CDC dcMem;
dcMem.CreateCompatibleDC( &dc );
CBitmap bitmap;
bitmap.CreateCompatibleBitmap( &dc, width, height );
CBitmap* pOldBitmap = dcMem.SelectObject( &bitmap );
//
// Draw
//
dc.BitBlt( 0, 0, width, height, &dcMem, 0, 0, SRCCOPY );
dcMem.SelectObject( pOldBitmap );
GoodLuck!
- NS -
|
|
|
|
|
Thanks a lot, it works!
Lisoft
|
|
|
|
|
Dear Friends,
I try to work with TAPI3.0 that is COM based, so in create an COM object it returns "CoCreateInstance on TAPI failed"
<br />
ITTAPI *TObj;<br />
HRESULT hr;<br />
hr = CoCreateInstance(<br />
CLSID_TAPI,<br />
NULL,<br />
CLSCTX_INPROC_SERVER,<br />
IID_ITTAPI,<br />
(LPVOID *)&TObj<br />
);<br />
if ( FAILED(hr) )<br />
{<br />
MessageBox("CoCreateInstance on TAPI failed");<br />
}<br />
is there any one help me ?
|
|
|
|