|
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 -
|
|
|
|
|
I am trying to create a window in which I display the html contents as in a browser. I have used the code given by jeff in(http://www.codeproject.com/com/cwebpage.asp) The Internet Explorer Server class in which the contents are actually displayed doesnt support Ctrl+C copy but supports select text->right click->copy. What should I do now? How do I implement Ctrl+C copy? Do you need any more information, pls let me know.
thnax
|
|
|
|
|
sanjay_ksk wrote:
doesnt support Ctrl+C copy but supports select text->right click->copy
If you get the Ctrl+C to your window, try to send the WM_COPY to html window.
It is only a try. Please don't blame me if it is not working, because I don't know how the copy text is implemented in your code.
Please let me know the results.
Goodluck!
- NS -
|
|
|
|
|
sanjay_ksk wrote:
supports select text->right click->copy
How did you implement the rightclick and copy?
- NS -
|
|
|
|
|
i havent! May be the code given by jeff does it. and I am new to MFC and OLE. I just created a window and passed the handle the html contents to jeff's code. Then he creates 3 other windows which are in the following order
--My Window->Shell Doc Object View->Shell Embedding->Internet Explorer Server.
In this Internet Explorer Server(IES) is where the contents are displayed. I can find the IES wnd handle and then probably handle messages. how do i write a message map for ctrl+c?
|
|
|
|
|
|
You can the function ExecWB in IWebBrowser2...
Eg:
ExecWB(OLECMDID_COPY, OLECMDEXECOPT_DONTPROMPTUSER, NULL, NULL);
The selected text in the web page will be copied to the Clipboard.
Articles on this are available in CP....
|
|
|
|
|
i have a question about scope of items in a static library.
is it possible to give access to members of a class to functions within the library, but not functions in the application referencing the library (such as the 'internal' keyword in c#) without specifying 'friend' for every class i need to have access to it?
sorry i worded that weird
|
|
|
|
|
No, I don't think so.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
thanks
it's hard moving from managed back to unmanaged
|
|
|
|
|
Yeah, I've moved from C# back to C++, and while I love it overall, there are definately things I notice are 'missing' ( although the same is true going the other way )
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Why is it that even when my worker thread has already done its task, I still can't touch my GUI? Debug Assertion Failed message occurs when the program is about to do something like, EnableWindow(TRUE) and calling OnCancel() to close the dialog. Please Help
|
|
|
|