|
Hi.
I want to create controls on the dialog box at runtime. I need to convert between dialog units and pixels.
I tried the following:
CFont *pFontDlg= GetFont(); // font of dialog.
LOGFONT logfont;
pFontDlg->GetLogFont(&logfont);
The problem is that the width (logfont.lfWidth)is zero. So I am unable to use the formula. Please help !!!
From : Digambar K. digambar_k2004@yahoo.co.in
Thanks....!!!!
|
|
|
|
|
This is a very bad idea. Dialog units are used for a reason, namely so that a program does not have to be concerned with what resolution and font are currently in use. By hard-coding controls based on pixel size, you have limited the portability of your program to only one computer. See this comment for more.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
I have written a program that used mschart and I install this program on the computer that not installed VC. the problem is if I set chart on the dialog directly,all that is ok.but if I create it in my codes dynamically,chart can not be shown. in my computer this problem does not exist,what is the reason?
|
|
|
|
|
hi
mschart is component usually registered with the MFC. that why u didn't get any problems whem u r working with ur system. If u want to install it some other machine which doesn't have the mschart component, you must explicitly register it with regsrv32 tool
naren
|
|
|
|
|
I have registered this componet
|
|
|
|
|
|
Please don't advertise in forums. This gets people VERY unhappy.
|
|
|
|
|
We're about to release software -- Cute Skin 2005 -- that makes it very easy, quick and affordable for you to create professional applications with skins that users can customize at run-time.
Visually create skins that can have any shape and that can dynamically be expanded to any size without distortion or loss in quality.
Effortlessly allow users of your professional application to customize the application's GUI while it runs. Cute Skin does all the hard work for you.
Skin any window you want -- main frame window, dialog box, etc, with ease.
Automatically generate fully functional professional applications (complete with C++ source code that you can edit and compile in Microsoft Visual C++) at the click of a button.
Visually customize all aspects of your professional application's graphical user interface using Cute Skin's highly visual and intuitive what-you-see-is-what-you-get (WYSIWYG) graphical user interface.
Create stunning and inspiring professional skins complete with Cute Backgrounds -- (backgrounds that can have any shape and that can be expanded to any size), standard backgrounds, complex and standard buttons, classical and standard thumbnails, scroll bars, sliders, combo boxes, list boxes, check boxes, custom progress bars, animations and much more.
Stand out from the competition! Create outstanding professional applications with ease!
You can view a screenshot of the current pre-release edition of Cute Skin 2005 at:
http://www.imatronics.com/cuteskin/screenshots
You can read a very brief summary of the features of Cute Skin 2005 here:
http://www.imatronics.com/cuteskin/cuteskin
You can also download the source code and executable files for a few sample applications built using Cute Skin 2005 here:
http://www.imatronics.com/cuteskin/featuredemos
And you can download the current FREE trial edition from:
http://www.imatronics.com/cuteskin/CuteSkin2005Setup.exe
Please download and evaluate this pre-release edition of Cute Skin 2005 and see just what a positive difference it makes in your professional application development projects.
Many thanks.
Frank.
|
|
|
|
|
|
Hi
Simple question. Why the constructor name has to be same as the class name?
Regards
John
|
|
|
|
|
|
Funny enough, in C with classes the constructors were called New
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
I want that whenever i type char : and ) it should be replaced.I am using following approch .
void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CRichEditCtrl::OnChar(nChar, nRepCnt, nFlags);
uPervChar=uNextChar;
uNextChar=nChar;
if(uPervChar==_T(':')&&uNextChar==_T(')'))
{
nEnd=GetWindowTextLength();
nBeg=nEnd-2;
SetSel(nBeg,nEnd);
ReplaceSel("");
}
}
It wroks fine .But its slow .Is there any other way pls tell me.
Learner always
|
|
|
|
|
I need to check somehow when a process starts or exit. Any ideas how we can do this?
|
|
|
|
|
You have to set a HOOK on process of type WH_CBT and listen for WM_QUIT,WM_CREATE Messages.
Api:- SetWindowsHookEx
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
I am trying to get data using OLEACC. It works fine when I fetch data from windows xp machine, however it fails to retrieve unicode data from Richedit20A control on windows 2000 machine. It gives ?????? for any of the unicode characters entered.
Anyone have any idea.
|
|
|
|
|
If it works on XP is should work on 2000. Usualy the only time you see ? marks is when the system can not translate from one character code format to anouther. May be you should try making sure that the 2000 machine is up to date as far as the OLEACC is concerned.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
I updated my machine after I found this error.
I even used accexplorer to check if this is some problem with my coding and as I thought, result was all the same, even accexplorer cannot get the data.
I found version numbers of dlls being used by these systems are different with XP having the latest, so I replaced those that I can, but no luck.
|
|
|
|
|
I have a list ctrl and want to sort it when user click the column. In my sort function, i only can get the item's lparam, but i need get the item's index then could use GetItemText function to compare two strings. I find i could use the FindItem to get the item index from the item's lparam, but it seems slow(if items more than 3000, the sort time is too long). So could any one teach me which function or which way I could use to get the item index effectively?
Thank you very much for your help!
|
|
|
|
|
|
Mike, Thank you very much! You really help me!
|
|
|
|
|
Are you calling the list control's SortItems() method? If so, the callback function will receive two LPARAM variables, lParam1 and lParam2 . Those are pointers and need to be cast to the same type of object that was used with SetItemData() . For example:
struct myStruct
{
int i;
char name[32];
};
...
int nIndex = InsertItem(...);
myStruct *p = new myStruct;
SetItemData(nIndex, (DWORD) p);
...
SortItems(CompareFunc, 0);
...
int CALLBACK CompareFunc( LPARAM lParam1, LPARAM lParam2, LPARAM )
{
int nReturn = 0;
myStruct *p1,
*p2;
p1 = (myStruct*) lParam1;
p2 = (myStruct*) lParam2;
...
} Make sense?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello
How do I send a specific key to a winow?
I tryed using the SendMessage function like this:
SendMessage(hwnd,WM_KEYDOWN,'A',0x2701);
I think it doesn't work because of the 4th parameter and I don't understand that parameter very well.Can anyone explain it to me, it is supposed to be some kind of a value that identifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table. But I don't understand this.
I also tryed sending a hotkey message to the window as I think that the letter I send is actually a hotkey because it is underlined. I tryed doing that like this:
SendMessage(hwnd,WM_HOTKEY,IDHOT_SNAPWINDOW,'A');
But it didn't work. Why?
Is there some other way that I can press a button on this window programaticly? The buttons on this window keep changing every time you run it and they have no names just handles so that would be pretty hard.
|
|
|
|
|
The WM_KEYDOWN message is sent to a window when the window has focus and a non-system keyboard key goes down and remains pressed. After the keyboard repeat delay, multiple WM_KEYDOWN messages are simultaneously generated. A non-system keyboard key is any key excluding F10 and keys pressed together with ALT. To simulate an ALT + key combination, use WM_SYSKEYDOWN message.
In order to simulate a keypress to a window, use WM_CHAR message. WM_CHAR messages are not translated anymore, so the keycode you issue for it will proceed directly as-is to the receiving window. WM_KEYDOWN messages have virtual key-codes that are translated to character codes. WM_CHAR messages have character-code (ASCII) values with them.
To precisely simulate a keypress (such as CTRL/SHIFT + key), you must generate virtual keypress events. This is much more complicated than just sending a single message. Check SendInput in MSDN. In here, you will generate sequentical keyboard events for each and every event of the key combination. Remember that pressing CTRL + SHIFT + F, for example, consists of first setting CTRL, SHIFT and F keys to pressed state, in order, and then releasing them, in inverse order. Note that to target the keypress combination, you must set the target window active by using SetFocus .
Also, if your program is running on a seperate thread than the target program, you must first attach the input streams by using AttachThreadInput , and detach them after you've synthesized the keystrokes.
-Antti Keskinen
----------------------------------------------
"If we wrote a report stating we saw a jet fighter with a howitzer, who's going to believe us ?"
-- R.A.F. pilot quote on seeing a Me 262 armed with a 50mm Mauser cannon.
|
|
|
|