|
|
How to change font of menu/submenu in MDI App developped with VC++6 and MFC ?
Any suggestion/solution?
Ana
|
|
|
|
|
I think you have to make the menu owner-drawn. There's an example i MSDN titled "Setting Fonts for Menu-Item Text Strings", it's in te Platform SDK docs.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
I want to handle WM_PAINT in my class which is derived from CStatic, but the control can't received msgs like WM_MOUSEMOVE, the parent received it. How can I let the control handle WM_MOUSEMOVE?
Thanks.
|
|
|
|
|
The control needs SS_NOTIFY,
so go to properties by right clicking the control and check the "Notify" checkbox within the "Styles" tab
SkyWalker
-- modified at 2:25 Thursday 22nd September, 2005
|
|
|
|
|
That solves something I have been thinking about recently, thank you
It pays to browse the message boards.
The tigress is here
|
|
|
|
|
i want to access the message queue of windowsSystem.
All the Events (like MouseEvents, keyboardEvents) will first enters in to the windowsSystem message queue and then operating system extract the messages and sends them into corresponding windows messageQueues...
I need to access the WindowsSystem message queue using MFC Application...
is there any functions to accesss message queue of windowsSytem.?
|
|
|
|
|
Look for articles on system wide message hooking, there is more than one at CP.
INTP
Every thing is relative...
|
|
|
|
|
Have you considered GetMessage() and/or PeekMessage() ?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I am creating a C++ programme which has a large use of Matlab functions that have been combined into a DLL. The C++ (Win Console) application calls the Matlab functions fine.
As the Matlab are very detailed (and written by colleague) once the DLL is entered, it uses 100% of the PC resources and does not return until processing is finished. Currently the Matlab DLL outputs text to the Console window as it progresses.
What I would like to do is to breakup the DLL call with calls back to C++ and replace the Matlab Console text outputs to be via a C++ DLL routine (which could be eventually turned into a Dialog Window) - the whole thing will still be compiled under C++.
I have had a go with the example:
http://www.codeproject.com/dll/beginnerdll.asp#xx846359xx[^]
And this is fine for creation of a DLL.
So I thought: how about use this DLL under the Matlab environment using the loadlibrary and calllib functions? It loads, but it cannot find the function SayHello. (which IS in the DLL)
I am hoping that any Matlab command lines I use to load and execute DLL functions in a specific DLL, will be able to be compiled and operate the same when itself is in a DLL.
My Matlab command lines are:
- loadlibrary('MyLib.dll', 'cMyClass.h')
this returns:
Warning: The data type 'error' used by function SayHello does not exist (x 3)
and
Warning: The function 'SayHello' was not found in the libary
- calllib('MyLib.dll')
This returns an empty array.
I think the warning messages when I load the library are due to the
CString definition (which I cannot seem to easily locate in a C++ h file)
1. Are there any good examples of Matlab calling a C-compiled DLL?
2. Is there a better way to reduce my 100% useage of resources which the Matlab code is running?
Any pointers will be greatly appreciated....
ntrprs
|
|
|
|
|
i am writing a code to send a packet of data in the form of structures over the comm port to hyper terminal. The code while compiling does not give any errors but at the hyper terminal i receive all junk values.
pls help me to work this out.
here is the code that i wrote
//____________________________________________________-
// to write from one port & to read on the other port using hyper terminal
#include "stdio.h"
#include "conio.h"
#include "stdlib.h"
#include "windows.h"
#include "dos.h"
#include "time.h"
#include "string.h"
#include "process.h"
#include "iostream.h"
struct human
{
char Name[4] ;
char grp[5] ;
int Age ;
};
char *port="COM2";
HANDLE hCom;
DCB dcb;
COMMTIMEOUTS comTimeout;
unsigned long n;
char ch;
int open_com(char * com);
void writecom(human *);
//----------------------------------------------------------------------------
void main()
{ human me = {"ajo","good",21};
human *s = &me;
open_com(port);
while(1)
{ writecom(&me);
ch = getch();
}
}
//----------------------------------------------------------------------------
int open_com(char * com){
hCom = CreateFile(com, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hCom == INVALID_HANDLE_VALUE)
{
printf("Open COM port failed!!!\n");
exit(0);
}
GetCommState(hCom, &dcb);
dcb.BaudRate = 9600;
dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
SetCommState(hCom, &dcb);
comTimeout.ReadIntervalTimeout = 300;
comTimeout.ReadTotalTimeoutMultiplier=300;
comTimeout.ReadTotalTimeoutConstant=300;
comTimeout.WriteTotalTimeoutMultiplier = 3;
comTimeout.WriteTotalTimeoutConstant = 2;
SetCommTimeouts(hCom, &comTimeout);
return 1;
}
//----------------------------------------------------------------------------
void writecom(human *s) {
WriteFile(hCom,s,sizeof(*s),&n,NULL);
}
|
|
|
|
|
Does your code work correctly if you are not using a struct ?
The writecom() function should probably be:
void writecom(human *s)
{
WriteFile(hCom,s,sizeof(struct human),&n,NULL);
}
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
-- modified at 9:10 Thursday 22nd September, 2005
|
|
|
|
|
yes the code works for char array and int arrays, it also works if i send only one field of the structure at a time. but not when i send the whole struct.
i will try this suggestion.
thk u
Ajo T.
|
|
|
|
|
it is not a good idea to send a data structure over the comport if you are using hyperterminal. a terminal uses text. you are better off formatting the text like this sprintf (txt,"%s, %s, %d", name, grp, age) and then copying the text to the com port. It is much easier to print and scan text. It is also much more reliable.
Just livin a dream.. dont wake me!
|
|
|
|
|
i was able to send the structure over the commport ,but the hyperterminal only prints char fields of the struct but not the int field, also there are some char's as <0><0> which gets printed along with the other char field
this is the output:
Ajo<0><0>good<0>ÌÌ<0><0><0>Àÿ
i don't know what could be wrong
pls suggest
Ajo T.
|
|
|
|
|
Ajo T wrote:
Ajo<0><0>good<0>ÌÌ<0><0><0>Àÿ
It looks like you are being affected by structure alignment. See if this helps:
#pragma pack(push, 1) // defaults to 8
struct human
{
char Name[4];
char grp[5];
int Age;
};
#pragma pack(pop)
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
hi
sprintf(.....) option works. thanks.
but i wanted to use a pointer to the struct human and then send this pointer to the writefile to send the struct.
the code i wrote for sending struct works but it prints only the char field's with some junk value for int field
see the next reply down.
i have shown the output.
thk
bye
Ajo T.
|
|
|
|
|
sorry the output is in the reply obove the previous one
Ajo T.
|
|
|
|
|
well, you just cannot send a data structure to hyperterminal because hyperterminal does not know how to decode the structure. It does now know how to interpret the data and it does not know how to print it. SEND TEXT.
Just livin a dream.. dont wake me!
|
|
|
|
|
multicolumn style support top to bottom first, which doesn't meet my need.
|
|
|
|
|
Maybe you need a list control instead.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi....
Can you help me.
Myname is :Tuyen.
Mail: tuyenlike@yahoo.com
I see problem as in clipboard windows contains data bitmap(Example i use paint of windows open file (*.bmp) select rectangle of picture and copy (Ctrl + C) or run one program result return clipboard windows data sturct bitmap) i want to program write by visual c++ to save data bitmat to make picture (*.bmp).
Thanks you very much.
-- modified at 0:19 Thursday 22nd September, 2005
|
|
|
|
|
BOOL b;<br />
b = IsClipboardFormatAvailable(CF_BITMAP);
b = OpenClipboard();<br />
HBITMAP h;<br />
h = (HBITMAP)GetClipboardData(CF_BITMAP);
You need to save the HBITMAP to file. Search on Google or CP for that.
If you need to display the bitmap also then:
CBitmap* pBmp;<br />
pBmp = CBitmap::FromHandle(h);<br />
b = CloseClipboard();
BITMAP bm;<br />
pBmp->GetBitmap(&bm);<br />
CClientDC cdc(this);<br />
CDC dc;<br />
dc.CreateCompatibleDC(&cdc);<br />
dc.SelectObject(h);<br />
cdc.BitBlt(10,10,bm.bmWidth,bm.bmHeight,&dc,0,0,SRCCOPY);
This code may not be error-free and complete.
this is this.
|
|
|
|
|
I have a window in which I display html contents. But I dont know who to implement Ctrl+C (Copy function) in it. And also when using the scroll bar to scroll the window scrolls but when I use the mouse scroll or press page Down or Arrow keys the window just moves up. Please give suggest me on how to fix this.
|
|
|
|
|
sanjay_ksk wrote:
I have a window in which I display html contents.
Are you using your own codes to display the HTML, then probably you have bug with vertical scrolling fn handling.
sanjay_ksk wrote:
to implement Ctrl+C (Copy function)
You should have a look at clipboard data copying and keyboard accelerator to implement Ctrl+C.
Or can you specify some thing more clear?
- NS -
|
|
|
|