|
i recieved this warning
: warning C4133: 'function' : incompatible types - from 'char [5]' to 'const unsigned short *'
for the first line of the code below
hCOM1 = CreateFile("COM1",
GENERIC_READ | GENERIC_WRITE,
0,
0,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0);
I copied the code below from an older program, but i did not get that warning when i tried to compile it. Is there something i am doing wrong ?
|
|
|
|
|
Definitely a problem with the "COM1" parameter. Possibly a Unicode problem? Don't have much experience with Unicode, sorry, but might try CreateFile(_T("COM1"), ....
Someone else will know for sure...
delete this;
* poof! *
|
|
|
|
|
Otherwise remove the unicode option from settings
never say die
|
|
|
|
|
It's a Unicode issue. I'd wager the old project was ANSI but now it's Unicode. Try making the following change:
hCOM1 = CreateFile(
_T("COM1"),
GENERIC_READ | GENERIC_WRITE,
0,
0,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0);
Make sure you include <tchar.h>
Steve
|
|
|
|
|
While it has nothing to do with warning C4133, that first argument will need to be changed to "\\\\.\\COM1" in order to open a serial port.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
hi all ,
can any body tell me how to add a function key concept to a win32
program....
thanx
your
peter
|
|
|
|
|
For me, this is a pretty ambigious question. Are you talking about menu accelerators, like &Edit -> &Copy (Ctrl+C), dialog box accelerators, or something else? What platform, MFC, WTL, other?
Not sure if I can help, but more info would be appreciated.
delete this;
* poof! *
|
|
|
|
|
Hi
How to get all the virtual printers ( for example: Acrobat PDFWriter, pdfFactory Pro, PDF995 etc.)installed on a machine?
I tried with the API "EnumPrinters()", but this returns all the printers (including both virtual and real printers) installed on the machine.
Development Tool and Platform used: VC++ .NET 2003 & Windows Xp.
Thanks in advance,
Jahfer.
|
|
|
|
|
i want to create a list of bitmasps so i think cimagelist is right choice for me if you have any other idea please share with me and the use of cimagelist control is right choice so please told me how can i use this control.
Bankey Khandelwal
Software Engineer
|
|
|
|
|
Do you use CimageList for CLitctrl?
|
|
|
|
|
hi all
i want to know when we first time add menuitem and after a while we again append them these menuitems are disalbled. why it is this in the toolbar and the menuitems.
ddd
|
|
|
|
|
tasleem143 wrote:
after a while we again append them these menuitems are disalbled
What do you mean by appending menuitems? Are you adding menus dynamically?
Bye,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
no no i mean add the new menuitem with new id.
ddd
-- modified at 2:06 Wednesday 8th March, 2006
|
|
|
|
|
You can set this member variable of CFrameWnd class to FALSE ...
CFrameWnd::m_bAutoMenuEnable = FALSE;
Do this inside the mainframe constructor. When this member variable is set to true new menu items with no ON_COMMAND and ON_UPDATE_COMMAND_UI handlers are disabled. By setting this member to FALSE you can prevent this.
Nibu thomas
Software Developer
|
|
|
|
|
SAME IS THE CASE WITH THE TOOLBAR HOW TO SOLVE THAT
ddd
|
|
|
|
|
Override OnCmdMsg and return TRUE . Don't forget to call the base class handler.
For eg:
BOOL CMainFrame::OnCmdMsg(UINT nID, <font color=blue>int</font> nCode, <font color=blue>void</font>* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
<font color=blue>return</font> TRUE;
}
Nibu thomas
Software Developer
|
|
|
|
|
In Vista, in one of my program, invoke "OpenService()" is being refused.
Who can tell me, how can I imporve my program's privilege? I logon as Administrator.
Best Regards.
|
|
|
|
|
Hi,
I want to know the difference between unions and structures in c++ world.
Yonis
|
|
|
|
|
Look Here[^]
Nibu thomas
Software Developer
|
|
|
|
|
Hello Nibu,
Good.
Good style.
I like it.
Divyang Mithaiwala
System Engineer & Software Developer
|
|
|
|
|
structures reserve memory for all the variables inside it. but Union takes up memory for only the thing that we assign value. and overwrites the same if a value is entered to antoher variable inside it.
VuNic
|
|
|
|
|
VuNic wrote: Union takes up memory for only the thing that we assign value
takes up memory for variable who has maximum amount of byte.
Divyang Mithaiwala
System Engineer & Software Developer
|
|
|
|
|
|
Your link contains content that verifies what the person-you-are-responding-to said...
The compiler allocates a piece of storage that is large enough to hold the largest variable type in the union What is the confusion?
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
hi VuNic,
VuNic wrote: Union takes up memory for only the thing that we assign value
i'm sorry to say that you are wrong.
a union occupies as much memory as the wider field of the union.
lets say we have this union :
union myU {
long l;
char c;
};
then, even if you assign c which is a char , so 1 byte, the union will weight 4 bits because the longuest field is l (long is 4 bytes).
myU u;
u.c = 5;
ASSERT(sizeof(u) == 4);
|
|
|
|