|
Hi again
Excuse me for asking what I am sure is a dum question, but here goes:
I have a Win32 "Typical Hello World" project VC6.0(written by others), which I am adapting to what I want to do. In my application I wish to have coloured buttons. I have previously made use of a ClrButton class in dialog boxes (which I believe I obtained from Code Guru).
If I simply include the files CClrButton.cpp & .h in my Win32 app, I come up with errors:
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Can someone point me in the right direction to working out how to do this. I havnt really got a grasp of the differences in creating a dialog and a win32 app - is there a tutorial that I can look at?
Sorry for asking what I am sure are simple questions, but if you dont ask...
Cheers
Mike
|
|
|
|
|
69 Bay wrote: is there a tutorial that I can look at?
Of course, tons of them. However they may not result in you understanding things any more than the sample you worked with did. Don't get fooled into believing one can "learn C++ in 21 days". For starter books on Win32 development try Petzold and Richter. There are others as well but I liked both of them.
Programming Windows 5th Edition[^]
|
|
|
|
|
The linking errors have to do with the libraries you are linking with. Go to your Project->Settings dialog in the C/C++ tab and select the Code Generation category. You will have a combo box with choices like "DLL Singlethreaded", "DLL Multithreaded", "Singlethreaded", "Multithreaded", etc. Try selecting the Multithreaded version. If that works, look at the code and figure out why it is creating a thread ... GUI components rarely need them.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
hi all,
i need to set the entire rich edit text to white....
i know there is a SetBackgroundColor method and to set the text i need to do SetDefaultCharFormat
but this doesn't work for me....
here is what i do:
CHARFORMAT2 cf;
m_edtMsg.GetDefaultCharFormat(cf);
cf.cbSize = sizeof(CHARFORMAT2);
cf.dwMask = CFM_COLOR;
cf.crTextColor = RGB(255,255,255);
m_edtMsg.SetDefaultCharFormat(cf);
when i start typing on the rich edit, i see the color hasn't been changed???
any help?
thanks in advanced
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
Actually you should put cf.cbSize = sizeof(CHARFORMAT2) before GetDefaultCharFormat , but it is even unneded in case of MFC.
May be you should also unset the CFE_AUTOCOLOR :
cf.dwEffects ^= ~CFE_AUTOCOLOR;
I think you do not need to use GetDefaultCharFormat . Maybe this will work for you:
CHARFORMAT2 cf = { 0 };
cf.dwMask = CFM_COLOR;
cf.crTextColor = RGB(0, 0, 255);
m_edtMsg.SetDefaultCharFormat(cf);
Hope it helps.
|
|
|
|
|
excellent ! works like a charm! (i placed ZeroMemory instead of the CHARFORMAT2 cf = { 0 }; )
an other question if i may... i am interested on paiting the scroll bar myself of the rich edit
which message should i catch (when ever the scroll bar is shown ) to call the drawing of the scroll bar?
thanks again for all the help
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
As I know, the scroll events for rich-edit control are EN_HSCROLL and EN_VSCROLL . In order to allow these notifications, you have to set a mask in dialog’s OnInitDialog :
m_edtMsg.SetEventMask(m_edtMsg.GetEventMask() | ENM_SCROLL);
In addition the scroll bars should be enabled in the Properties panel.
If you want to change the colours of scroll bar, I think you can try the WM_CTLCOLOR or WM_CTLCOLORSCROLLBAR notifications.
If you create your own scroll-bars (for instance, derived from CScrollBar ) and put them near the edit control, then the scroll notifications will be WM_HSCROLL and WM_VSCROLL .
|
|
|
|
|
When I display the properties of a file using Explorer,
there is often a "Summary" tab, containing information
such as Title, Subject ...
How can I read and write those properties with VC++
Thanks for any help.
Peter
|
|
|
|
|
See here.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
This is fine for a doc file, but it does not work for a "normal" text file.
I created a file using Notepad, and used Explorer to change the summary. I want to copy the summary information from one text file to another.
When I used the example given by Microsoft in
http://support.microsoft.com/kb/186898/EN-US,
it worked for a doc file, but complained that the text file was not a compound file.
-- modified at 5:01 Wednesday 21st June, 2006
|
|
|
|
|
petergggg wrote: This is fine for a doc file, but it does not work for a "normal" text file.
Sure it does. Just use StgOpenStorageEx() instead.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
can be change button color if yes plz send me code for his
Please mail me
|
|
|
|
|
I think it is better to derive a class for the button from CButton and override DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct).Here u can draw the button, and can give color u wanted to your button.
yours faithfully
ajeeshcv
|
|
|
|
|
yogendra kaushik wrote: can be change button color
Have a look on CBitmapButton class
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
you can derived CButton and use from WM_DRAWITEM of course you need to set OwnerDrae for button from property window
whitesky
|
|
|
|
|
I like to autosize the owner draw button depending upon the text that it load dynamically based on localization strings. so some strings are large than others. Keeping this I override DrawItem in the inherited class from CButton. (In below i tried unconditionally to increase the size at runtime, once it is achived, i think i can go ahead for resize code)
The sample code is below
void CMyGraphicButton::DrawItem (LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CString cs;
CString cslong;
ASSERT(lpDrawItemStruct->CtlType == ODT_BUTTON);
LPCTSTR lpszText = (LPCTSTR) lpDrawItemStruct->itemData;
if (!lpszText || lpszText == (LPCTSTR)-1)
{
GetWindowText (cs);
}
else
cs = lpszText;
// now i m trying to resize , so let try to increase the size of button unconditioally
// I get
//lpDrawItemStruct>rcItem.left =0
//lpDrawItemStruct>rcItem.right =75
//lpDrawItemStruct>rcItem.top = 0
//lpDrawItemStruct>rcItem.bottom = 25
//As my button is on extreme right side of dialog so i tried to extend/increase the size of
// button of the left side as follows
lpDrawItemStruct>rcItem.left -= 25 ;
// but the above causes the text to be moved on right side insead of resize/increase the
//button size.
Any idea or help is appriciated.
Thanks
Anil
}
[AKS]
|
|
|
|
|
Hi sir/mam,
I set up BREW application and made a project name "helloworld". But when I develop BREW then there are so many applets form. I pass the string in "Helloworld" and it is coming.but the problem is that how can I develope the C++ code under Helloworld. I tried but fail to develop the C++ code. Because the file of C++ code not supported(#include "iostream"). So how Can go for it please help me out for it or tell the other process for authentication for brew. Or is there any other file for supporting BREW. Please Tell me the process.
How can I write a C++ program in BREW.
Thanks.....
Nitin Dalal
nitin
|
|
|
|
|
stop asking the same question every 6 hours...
if no one answer you, it's because either no one knows, or the question is not asked correctly... suss:
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
|
Sit in the brew and write some code?
Steve
|
|
|
|
|
what is it(BREW)
whitesky
|
|
|
|
|
As tox said, if you don't get answers here, it's because noone knows about BREW here.
Maybe you should try the forums at Qualcomm instead? It seems as the obvious place to discuss BREW problems.
Try here[^]
And here[^]
Else, Google is good.
|
|
|
|
|
I sed parameters to SMPPLIbClient program,but server is not cannected in the same time program didn't show any errors plz help me any one
#sankar#
|
|
|
|
|
please tell me how to fit the bitmap to dialog which is high pixels
vasu
|
|
|
|
|
like this
<br />
USES_CONVERSION;<br />
CRect rect;<br />
Image *img ;<br />
ImageAttributes imAttrib; <br />
<br />
Graphics graphics(GetDC()->m_hDC) ;<br />
GetWindowRect(rect);<br />
img = Image::FromFile(A2W("C:\\0.bmp")) ;<br />
graphics.DrawImage(img,Rect(0,0,rect.right,rect.bottom),<br />
0,0,img ->GetWidth(),img ->GetHeight(),<br />
UnitPixel,&imAttrib);<br />
whitesky
|
|
|
|