|
this doesn't work either... sorry
|
|
|
|
|
ok.
I have a small app, that i have tested with DHTML control,
and RichEdit. you give me your email address i will send it for you
bye
|
|
|
|
|
kfaday wrote:
how do i write to the rich edit?
Use SetWindowText() , or ReplaceSel() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I derived a new class named CMySocket from CSocket.
Then generate another class named CCollectorInfo (in order to store the information of Collector),I defined a CMySocket pointer in this class.
Already included the header file of CMySocket
I got error messages as follow:
--------------------Configuration: SaroTransfer - Win32 Debug--------------------
Compiling...
MySocket.cpp
c:\documents and settings\administrator\×ÀÃæ\sarotransfer\collectorinfo.h(22) : error C2143: syntax error : missing ';' before '*'
c:\documents and settings\administrator\×ÀÃæ\sarotransfer\collectorinfo.h(22) : error C2501: 'CMySocket' : missing storage-class or type specifiers
c:\documents and settings\administrator\×ÀÃæ\sarotransfer\collectorinfo.h(22) : error C2501: 'pSocket' : missing storage-class or type specifiers
Error executing cl.exe.
SaroTransfer.exe - 3 error(s), 0 warning(s)
Thanks of any help!
|
|
|
|
|
You are missing a semicolon. It could be in MySocket.cpp before line 22, or it could be in one of the header files that you included in MySocket.cpp
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Sounds like the compiler doesn't recognize CMySocket . If you included MySocket.h inside collectorinfo.h, then announce the class in collectorinfo.h by typing class CMySocket before any declarations.
Or inlcude the header inside collectorinfo.h.
We are men. We are different. We have only one word for soap. We do not own candles. We have never seen anything of any value in a craft shop. We do not own magazines full of photographs of celebrities with their clothes on. - Steve
|
|
|
|
|
Erverthing is ok today! I don't know why
|
|
|
|
|
Anyway,thanks a lot for your replies.
|
|
|
|
|
ocean2000 wrote:
Erverthing is ok today! I don't know why
... better than the other way around
We are men. We are different. We have only one word for soap. We do not own candles. We have never seen anything of any value in a craft shop. We do not own magazines full of photographs of celebrities with their clothes on. - Steve
|
|
|
|
|
Hi,
I have a MFC dialog-based app that uses a CAsyncSocket derived class to send/recieve data. The application recieves fixed-length packets, and seemingly, an indeterminate number of them at a time. So I allot a moderately sized array of my small fixed-length structs to recieve the packet and loop through them and process them. This works well enough, though if there is a better solution I'd be interested. Anyway, for debugging purposes, I had a CListBox log the results of this processing, and when I started to remove the debugging lines I started to experience a massive lost and corruption of packets. If I go back and uncomment the CListBox.InsertString line, the packets are recieved fairly well, with a corrupt one, very infrequently. It doesn't matter if the lines to construct the string are present, just that one gets inserted, even a null string will make it work correctly. I would understand if the lost/corruption happened when this processing was done, but it doesn't make sense. Has anybody seen this before? Have I might some sort of fault design choice?
Thanks
-Aaron
modified 12-Jul-20 21:01pm.
|
|
|
|
|
How do you know they are corrupt/missing?
A socket will ensure that you only get valid data, and if anything is corrupted it won't pass it on to you until it has been resent - this is all handled transparently. I would take a guess that the corruption is due to your program overwriting memory, or not terminating or constructing a string properly. You are using an asyncsocket, so you cannot guarantee that you will receive each packet fully - how are you forming the received packets?
|
|
|
|
|
I know they're corrupt because the results they produce don't fit in with the other data, that's the best way to describe it, I get values way beyond the bounds of what they should be. For example, below, nType, 90% of the time that should be 1 or 2, yet I frequently recieve 3s and 4s, and I know the server program isn't sending them.
I see what you mean about not fullying recieving some packets, that would make sense to some extent. What I'm sending/recieving are structs like this:
struct someMessage {
short nType;
float fX;
float fY;
unsigned int wParam;
unsigned int lParam;
};
My OnRecieve handler looks something like this:
int nSent=0;
int nMax=20;
someMessage Msg[20];
nSent=m_Sock.Receive(&Msg,sizeof(Msg));
for(int x=0;x<nMax;x++)
{
}
How can I ensure that I only grab complete "packets" and that the partials are left to be completed? I am under the impression its bad to peek at the buffer and then take action on what's in there. And according to MSDN, any unread data is lost, so I'm at a lost of how I can get the partials too?
Thanks
modified 12-Jul-20 21:01pm.
|
|
|
|
|
You need to check the nSent value to see whether you have received enough data to fill your struct. If you receive fewer bytes than the structure, then you will need to wait (i.e. dont process the message, just wait for the next OnReceive) and add the new data's together. This in turn may mean you have enough data for 1.5 structures etc... the trick is to design a good buffering mechanism. The best way to do this is to buffer into a char array, and append onto the end for each OnReceive. Every time you have enough data, you can copy it into a structure and process it, and then move the remaining data in the buffer (if any) to the start.
|
|
|
|
|
Thanks, I'll have to look into making that buffering mechanism. But tentatively, I check nSent%sizeof(someMessage) and I have yet to get a value other than 0.
modified 12-Jul-20 21:01pm.
|
|
|
|
|
Hello
I created a substitue title bar to replace the original title bar (gradient fill...)
of Dialog or CMDIFrameWnd or CMDIChildWnd.First i remove the original titlebar of windows.
Then i created a substitue window with style :
WS_VISIBLE | WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
and i put this window as the same place as original title bar:
RECT rcWnd;
::GetWindowRect(m_pParentWnd->m_hWnd, &rcWnd);
// The m_pParentWnd is the CWnd of Dialog or
// frame that i pass to this class.
TITLEBARINFO tbi;
tbi.cbSize = sizeof(TITLEBARINFO);
::GetTitleBarInfo(m_pParentWnd->m_hWnd, &tbi);
RECT rcTitlebar = tbi.rcTitleBar;
//Calculate the rect we need to create substitute
// window for titlebar
RECT rcSubstitute = {rcWnd.left, rcWnd.top,
rcWnd.right, rcTitlebar.bottom};
//pszTitle is text on title bar
//The CBMSTITLEBARDIALOG_CLASSNAME is already
register before create window
DWORD dwStyle = WS_VISIBLE | WS_POPUP |
WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
BOOL bResult = CreateEx(WS_EX_TOOLWINDOW,
CBMSTITLEBARDIALOG_CLASSNAME,
pszWindowName, dwStyle,
rcSubstitute.left,
rcSubstitute.top,
rcSubstitute.right - rcSubstitute.left,
rcSubstitute.bottom - rcSubstitute.top,
m_pParentWnd->m_hWnd,
NULL, NULL );
If the parent window is CMDIFrameWnd or CMDIChildWnd, it's ok
the substistute title bar is put the same place with the original titlebar and have these effects that i want.
But with dialog the substistue title bar was wrong.
(Not the same place with original title bar). ???
I think because the Dialog has WS_POPUP style, and the
Substitue title bar that i create has the same WS_POPUP style. So it's wrong, is it right ? or some another reason.
Please help me. Thanks
|
|
|
|
|
I'm looking at writing an application that can import certificate files into Internet Explorer, or export them from Internet Explorer to a file. There are a ton of certificate APIs, but none of them seem to do what I need. Is there anyone here with certificate experience that has done something like this, or something similar that can help me out?
|
|
|
|
|
Am I the only one who's noticed this? Has it only happened to me?
It seems that, if you have a multiline edit in an XP-themed app (i.e., an app using ComCtl32 v.6), the word wrap does not take into account accented characters and breaks on them. So, for example, if I write "error de aplicación" in Spanish and the edit happens to want to break around the end of the last word, it might break immediately after the "ó".
I would be interested to see if anyone's seen this because I've fixed it by writing a callback to handle word wrap, modified from some ancient code from a Microsoft example. This has, in turn, highlighted another bug, this time in the definition of the first parameter received by EditWordBreakProc.
It might be worth turning this into an article, but am I the only one seeing this problem?
|
|
|
|
|
How can I make a grid control cell multiline so that I can edit it like I would normally, with pressing enter between lines etc.? I have a grid control created at runtime and have tried changing the dwStyle flags in the create function but nothing happens.
|
|
|
|
|
|
What code should I put in a handler for CButton in order to close SDI application? I tried with PostMessage(WM_QUIT) , but
CDocument::OnCloseDocument() doesn't get called in this case.
CButton is created in a CFormView class.
|
|
|
|
|
|
|
The menus in the project I am working on come up in response to Alt key functionanlity but the underlined characters in the menu do not respond.
(Alt-F brings up the file menu but Alt-F X does not Exit the program). The arrow keys move me up and down and expand sub menus but the mnemonic keys just don't work. Any ideas?
|
|
|
|
|
I'm trying to write a simple C++ GUI-less app that will be activated through an IE button - the code will do one thing and one thing only, but it involves placing text into fields of another program that is already running. what I need to know is: How do I code it so I can place the appropriate text in the appropriate fields of the other application? Specifically, I am trying to work with Remedy software, and I'm trying to automate the task of creating a new profile based off the information displayed in a webpage. all i need it to do is chug through the HTML for the needed info, then put it in the appropriate fields in Remedy and save the profle. I'm looking to learn, so any guidance would be more appreciated than unexplained code. send emails to joe_public34@yahoo.com Thanks!
|
|
|
|
|
Hi,
I have a visual C++ program with a couple menus. Upon entering each menu, I have something along the lines of this:
ttc_toolTips = new CToolTipCtrl();
ttc_toolTips->Create( this);
ttc_toolTips is a CToolTipCtrl pointer. And this is called within an overriden dialog class thus the reason for the "this" parameter to Create().
I tested this program on several machines running Windows 2000. The program seems to work on most systems except just one machine. On the machine that crashes, the program will work fine at first, but when I enter, exit about 10 menus which create tool tips like the code above, The CToolTipCtrl->Create function will fail and return 0.
When Create fails I get a message in the Visual C++ debug window along the lines of "Warning: Create window failed, GetLastError returned 0x00000000". Its true I don't deallocate the CToolTipCtrl objects created from the last 10 menus, but this machine has at 512MB of memory which is double the amount of memory some of these other machines have, and on these machines with less memory the program doesn't crash after like 50+ menus.
This seems strange to me and I can only ask under what conditions the Create function of CToolTipCtrl class can fail. Does it fail when I run out of memory? Could it be a result of hardware failure or bad video drivers? Note: I stepped through in the debugger and the "this" parameter passed to Create alawys has a valid dialog pointer, however the check ASSERT(::isWindow(hwnd)) within CToolTipCtrl class fails.
I also perform memory leak detection and _ASSERTE( _CrtCheckMemory( ) ); checks in many places of my code to make sure I'm not corrupting the heap anywhere. This is driving me nuts.
Any hints?
Thanks for reading this long message!
|
|
|
|