|
You can , for example, draw a CStatic (give it a real name, not the default one!) and get its CRect.
You can then Create() another Control (say, CEdit ) on top of it.
All the following is completely from head to keys. It probably does not compile:
test.h:
CTest : public CDialog
{
...
CStatic m_Placeholder;
CEdit m_Edit;
...
}
test.cpp:
...
void CTest::Overwrite_static()
{
CRect rect;
m_Placeholder.GetWindowRect(&rect);
m_Edit.Create(youreditstyle, rect, this, 1 )
}
...
This way your m_Edit sits directly on top of m_Placeholder.
I hope this was about what you intended.
--
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
|
|
|
|
|
In the Encapsulating Win32 Threads in C++ article on this website[1], I have downloaded the Demo code and loaded it into VC++ (manually, ie one file at a time). However I am getting the following error:
C:\temp\boserver\test\CMyThread.cpp(34) : error C2065: '_T' : undeclared identifier
I am wondering have I done something silly like not included a header file, or a library or something silly of the sort. Thank you for your time,
--Mark
[1] http://www.codeproject.com/threads/thread_win32.asp
|
|
|
|
|
_T (or _TEXT) is used to allow string literals to be compiled as either MBCS or UNICODE, and it is defined in tchar.h as something like:
#ifdef _UNICODE
#define _T(x) L##x
#else
#define _T(x) x
#endif
Dave
|
|
|
|
|
#include <tchar.h>
Michel
<i>It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.</i>
<br> - TreeBeard
|
|
|
|
|
Is there any who can help???
I want a windowobject (works as an graph class) to have its own OnPaint call so that its not the mainframe thats have to make the OnPaint Call. In this way it will work much faster...
Please, I really want this help... Its for studying - Very important...
by the way im new at this CodeProject... it seems to be a cool site...
THANKS!!!!
HUSTLER!!!
|
|
|
|
|
I guess it's one way in VC to solve your problem
1) use Class Wizard to insert a new class in your project,
2) inherit it from CStatic class (or whatever you want),
3) in your new class add a windows message handler for message WM_PAINT,
4) in this handler do what you want
5) change the class declaration of your window object to your new class
Dmitry Timin
|
|
|
|
|
hi all,
I have an image saved into clipboard, it is possible to print it? how?
If I save the file how to print it?
tks!
|
|
|
|
|
Here is a small example that plots a metafile from the clipboard into a DC. This would work with a display DC or a printer DC:
CRect metafile(0, 0, 100, 100);
if (IsClipboardFormatAvailable(CF_METAFILEPICT))
{
GLOBALHANDLE hGMem ;
LPMETAFILEPICT lpMFP ;
OpenClipboard() ;
hGMem = GetClipboardData(CF_METAFILEPICT) ;
lpMFP = (LPMETAFILEPICT)GlobalLock(hGMem) ;
pDC->SaveDC() ;
pDC->SetMapMode(lpMFP->mm) ;
pDC->SetViewportExt(metafile.Width(), metafile.Height()) ;
pDC->SetViewportOrg(metafile.left, metafile.top) ;
pDC->PlayMetaFile(lpMFP->hMF) ;
VERIFY(pDC->RestoreDC(-1)) ;
GlobalUnlock(hGMem) ;
CloseClipboard() ;
}
Roger Allen
Sonork 100.10016
In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!
|
|
|
|
|
Hi.
I would like to scale a progress bar for smaller numbers. For example:
x = 0
y = 999999999
I would lke to update the progress bar such that you will see changes, i.e. progress even though the x is still small. In other words, x = 1000 will update the progress bar just a slightly even though it is not 1% of y.
Is that possible and how do you scale the progress bar for such a slight change?
Thanks,
Kuphryn
|
|
|
|
|
You set the progress bars range to be 0-99999999 and then set it's position. SetRange and maybe SetStep are the methods you need.
http://msdn.microsoft.com[^] is your friend when you want to know how to do something with MFC.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I have a question about TreeCtrl.
When I use mouse right click one item in the TreeCtrl, this item is highlight when the right mouse key is down. But when the right mouse key is up, this item loses highlight, the previous highlight item is highlight again.
How can I keep the item that I right click highlight?
Thanks in advance.
|
|
|
|
|
<br />
void CFileViewTab::OnRclickTreeWorkspace(NMHDR* pNMHDR, LRESULT* pResult) <br />
{<br />
LRESULT lReturn = 0;<br />
CPoint point(GetMessagePos());<br />
ScreenToClient(&point);<br />
CTreeCtrl *pTree = (CTreeCtrl *)GetDlgItem(IDC_TREE_WORKSPACE);<br />
UINT flag;<br />
HTREEITEM hItem;<br />
if ((hItem = pTree->HitTest(point, &flag)) != NULL) {<br />
if (flag & TVHT_ONITEM) {<br />
pTree->SelectItem(hItem);<br />
......<br />
.....<br />
|
|
|
|
|
If you highlight a bunch of Excel files and then right click and select Open from the menu, a single copy of Excel starts up with all files opened. I've been trying to make an MDI app of my own to work this same way, but to no avail. Does anyone have a link to an article that describes the techniques used to do this. Thanks for any tips.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
The first thing you need to do is make your app single instance. Then when it starts up and the other instance already exists, pass this command line over to it so it can load the file.
I have done this with a variant of one of the single instance[^] classes here on CP. If you get this working on your app, I can send you the info about the extra mods to allow you to open files passed in on the command line.
Roger Allen
Sonork 100.10016
In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!
|
|
|
|
|
I was thinking single instance with subsequent instances sending messages to the first. Your link to PJ's article will be a big help with this. Thanks a lot.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
Roger, I just thought I'd pass along, that with some more experimenting and research, I've discovered that a straight out of the box, App-Wizard generated MDI app, where you specify the file extension for the document, will behave exactly the way I described. So now I'm just going through all the changes that have been applied to my existing app to locate code that's been removed and thus causing this needed behaviour to go away. It looks to be mostly related to ensuring a wack of registry entries are setup so as to obtain this behaviour.
Thanks again.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
|
hi,
I'm new in C++ and i really don't know how to change the font size and font face of a static text control. In Visual Basic it's quite simple
Hope anybody can help me,
ckr
|
|
|
|
|
If using MFC, it is as easy as the CWnd::SetFont(...) function.
Peace!
-=- James (Sonork:100.21837)
[Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!] [Get Check Favorites 1.5 Now!]
|
|
|
|
|
Hi,
I have an ATL COM DLL, with a method which needs to be used to pass a string in & out from VB. In the interface it's declared as [in,out] BSTR*. Yet the string which is passed back to VB always appears empty.
If I change things slightly to [out,retval] BSTR*. The method is seen to VB as a function and the string returns fine.
Anyone any clues? or examples, tried all sorts.
Cheers
Rich
|
|
|
|
|
I thought if it's an in out parameter you need to pass a string into the function, not expect it as a return value. Works for me in VBScript, but I dunno about VB. I expect it's the same.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Hello,
First off im no guru on this.. I am trying to learn how to use network event objects...
I followed an article here on Codeproject and have been researching this on Google and MSDN but I can't figure it out.. I guess I have a few questions.. 1st.. Does the third value in WSAWaitForMultipleEvents sleep the thread when its set to TRUE?? If its supposed to then something is wrong with my code because it doesn't sleep..
2nd.. Does this code look right? Am I missing something? I put a break point on the if((wsaCloseEvent.lNetworkEvents & FD_CLOSE)) and it goes right past.. doesn't seem like the thread is waiting for the event to happen.. It just goes right past..
3rd.. any suggestions on where i can get more info on Network event objects and some samples?
Thanks!!
Rob
WSAEVENT hEvent = WSACreateEvent();
WSAEventSelect(s,hEvent,FD_CLOSE);
int nErrorSelect = WSAGetLastError();
if(nErrorSelect != 0)
{
}
else
{
WSANETWORKEVENTS wsaCloseEvent;
WSAEnumNetworkEvents(s, hEvent, &wsaCloseEvent);
WSAEVENT* pEvents = (WSAEVENT*)::calloc(1, sizeof(WSAEVENT));
pEvents[0] = hEvent;
WSAWaitForMultipleEvents(1, pEvents,
TRUE, INFINITE, FALSE);
if((wsaCloseEvent.lNetworkEvents & FD_CLOSE))
{
WSACloseEvent(hEvent);
closesocket(s);
PostThreadMessage(UWM_CLOSE_SOCKET,0,0);
}
|
|
|
|
|
Hello...
Does anybody know how to get information about that?
I need to know if the taskbar is visible (or without the autohiding property selected) and it's height.
Thank you very much...
NOTE:
it would be great for me knowing how to set that property programatically...
|
|
|
|
|
try this:
APPBARDATA abd;
UINT fuState;
fuState = (UINT) SHAppBarMessage(ABM_GETSTATE, &abd);
fuState will be zero if the taskbar is not in the autohide or always-on-top state. Otherwise, it will be one or both of the following:
ABS_ALWAYSONTOP
ABS_AUTOHIDE
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|