|
Is bringing your assembler code to a CPP file an option ?
here's an example, even with a return value
word Out(char p1, word p2)
{
word param;
_asm
{
mov ah, p1
mov cx, p2
..
..
mov param, cx
}
return param;
};
Hope it helps,
DarkByte
|
|
|
|
|
I'm working on a Win32 (actually, Qt) app, and would like to use the alt key to modify some keyboard/mouse buttons. It's working great, except that pressing the alt key moves the keyboard focus to the menu (like it normally should). How can I disable/avoid that? Most importantly, is there a simple solution, without having to manually process messages?
Thanks!
|
|
|
|
|
I don't think there's an easy solution. Especially not so with Qt, as it probably hides the message pump from you.
I tried this in MFC:
BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
if((pMsg->message == WM_SYSKEYDOWN || pMsg->message == WM_SYSKEYUP)
&& pMsg->wParam == VK_MENU) {
DoMything();
return TRUE;
}
return CFrameWnd::PreTranslateMessage(pMsg);
} and it worked fairly well I believe. It didn't mess with the accelerators (ALT-F for File Menu, ALT-F4 for close application, etc), but it allowed me to do whatever I want to with the ALT-button. In this case I'm just filtering it out. If it's possible to implement a PreTranslateMessage() function in Qt, it's not a hard problem.
Good luck.
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
Thanks! Qt does have its own version of PreTranslateMessage, and I implemented it like so:
<br />
if(pMsg->message == WM_SYSKEYUP && pMsg->wParam == VK_MENU && bIgnoreNextMenuKey)<br />
return true;<br />
|
|
|
|
|
hi everyone.. i'd like to ask a very² simple question.. i guess it's too simple to post it here
say i have this equation.. c=a+b..
i want to make an interface which has 3 edit boxes and a button. two boxes for the user to input a and b and another box is for the answer (which is the c).. with the press of the button, i can get the answer in the answer box. my question is, how to pass the values in the two input boxes (a & b)to the button and pass the answer to the answer box (c)?
thanx for your guidance and time..
~wilDcat~
|
|
|
|
|
I've been using C# for a number of months, so I'm a bit rusty on Visual C++, but I'll try to help you out.
You can get the values in a number of ways, but I have always found the following to be the easiest:
CString A_Value, B_Value, C_Value;<br />
EditBoxA.GetWindowText( A_Value );<br />
EditBoxB.GetWindowText( B_Value );<br />
<br />
int TempA = 0;<br />
for ( int x = 0; x < A_Value.GetLength(); x++ )<br />
TempA = isdigit(CurrentSelection[x])?TempA*10+(CurrentSelection[x] -48):TempA;<br />
<br />
int TempB = 0;<br />
for ( int x = 0; x < B_Value.GetLength(); x++ )<br />
TempB = isdigit(CurrentSelection[x])?TempB*10+(CurrentSelection[x] -48):TempB;<br />
<br />
CValue.Format( "%d", TempA+TempB );<br />
EditBoxC.SetWindowText( CValue );
The Above should work...again, I have used C++ for a while, there may be an easier method of parsing the strings into integer values, but those loops will work (although they don't work for doubles, only integers...you'll have to figure that out on your own.)
Good luck, I hope I at least gave you an idea of what you can do.
-Doug
|
|
|
|
|
thanx very much.. at least u give me something to work on.. i'm new to vc but i'll try it out.. thanks very much!
~wilDcat~
|
|
|
|
|
You can use strtol() , strtoul() , or strtod() (among others) to convert strings to numbers.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
I need a GetClusterSize function so that I can work out how much space a file will occupy on a particular disk.
The WIN32 function GetDiskFreeSpace should do this but doesn't work for large disks. The replacement, GetDiskFreeSpaceEx, doesn't have this capability.
So what do I do?
Target is any WIN32, VC++ 6, MFC.
|
|
|
|
|
Hello,
is there a way to make a HFONT out of a TTF file? without installing the font? (I need a font for my project, but I don't want to mess up with the installation - and I also want it to be working when the user reinstalls the OS and keeps the app)
thanks a lot
|
|
|
|
|
try and take a look at AddFontFile(...) which maps to GdipPrivateAddFontFile(...) in GDI+.
Do a search on MSDN for the functions i mentioned or try "Font Functions" in the search box.
DarkByte
|
|
|
|
|
How can I rename an NT user using the ADSI(Active Directory Service Interfaces)? The IADs::SetInfo method can only change user's fullname not rename a user.
|
|
|
|
|
hi all!
Mu problem is to draw the scrolbars on my application.
It is realized with mfc and it is MDI.
I wanto to draw the scrollbars on the child window when I load an image larger than the window.
I try to edit code in the ChilFrm.cpp file and i wrote this:
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;
cs.style |= WS_VSCROLL | WS_HSCROLL;
return TRUE;
}
In this way the two scrollbar appear, but they don't do anything.
can you help me?
thks a sorry for my english
|
|
|
|
|
cruscotto wrote:
In this way the two scrollbar appear
yes it will coz you are enableing both the scroll bars...
you need to use setscrollrange method to start working on the scrollbar...
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
ok, i added the setscrollrange function to my code for both scrollbars.
Now i want the they appear only when i load an image that is larger than the window. I see that exist the ShowScrollBar function, but it give me a runtime error, always!I put the code in the precreatewindow of the childFrm class.
can you explain me?
|
|
|
|
|
I am using the Win32 toolbar common control in some code. When I resize the window that the toolbar is parented to it flickers. Is there any way to stop this?
The toolbar's parent window is created with no brush, and returns false for WM_ERASEBKGND. Is there some thing special about the way I need to handle the toolbar itself?
Thanks
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
|
I checked, and all of my controls have the WS_CLIPCHILDREN bit set, the main window, and the any custom child control's that get created (the toolbar's parent is a custom child control)
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
|
|
|
|
|
Hey there
I've just started to learn programming and using visual basic 6 (teaching myself) would really appreciate it if someone could explain to me how it is that variables work and exactly how to use them as this part has got me stumped.
Thanx a million
Style
Work hard, Play hard
|
|
|
|
|
since this is a VB6 Q.
you should send it to the vb forum not vc++
anyway :
you use variables to store some data in memory for processing...
for example..
dim a as single
dim b as single
dim c as single 'here i made 3 place holders in memory for single variables.
a=CSng(Text1.Text) 'read data from Text1 into memory location called a
b=CSng(Text2.Text) 'read data from Text1 into memory location called b
c=(a+b)/2 'get the avarage of the two numbers and store it in c for latter use
MsgBox c 'use the variable c
|
|
|
|
|
hi...
I've to much deep child to which i want to sen msg. from mainfrm class..
as there r some RUNTIME_CLASS...
so can't understand how to pass msg. from mainframe to that class..
can anybody help me..
I've hint as v may need to use FindWindow..But can't get solution yet from tweo days..
can anybody help?
THanks
---Sumit Kapoor--- sumit_kapoor1980@hotmail.com
|
|
|
|
|
You have asked this question before. A quick look in MSDN will reveal a host of functions that you could use to find the CWnd pointer to the window you want to send the message to. Look up CWnd, CFrameWnd, CSplitterWnd, CView, and CDocument. Read what each of the member functions does, and find the ones that will do what you want.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Hello every body
I'm writting a GUI TOol Kit for MFC control, for every controls of MFC
CButton,... I replace with CBMSButton... and i use the
DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) function to draw.
IT work fine with button,Titlebar, CheckBox, Radio
But with CComboBoxEx i replace with CBMSComboBox and i call DrawItem
but this function isn't called. I don't know why ?
Please help me. Thank so much
|
|
|
|
|
I have had to use the CBS_OWNERDRAWVARIABLE style instead of the CBS_OWNERDRAWFIXED style to get the DrawItem function to work. I do not know why CBS_OWNERDRAWFIXED did not work.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Hi,
I want to use SMTP (sendmail) to send email where the body is an HTML document rather than plain text, is this possible and if so how do I go about doing it? I haven't been able to find any sample code other than plain text emails.
Regards
Robert Cooper
|
|
|
|