|
OK,
You right click on Resource, and then chose insert, chose Bitmap.
IT's ok, if the bitmap is creater than 256 colors, it will not view on Editor, but when you run your app, and load your bitmap, you will see normally.
|
|
|
|
|
hey i know how to get variable args and insert them in a string what im wondering is what is the proper way to convert the args into thier actual data from the va_list variable? for instance i want my function to recive ints and then i want to use those ints not insert them into a string
Thanks
|
|
|
|
|
I should imagine the atoi function is what you are after. The prototype for the function is
int atoi(const char *nptr);
There may well be some better way of doing this but I don't know it if there is.
HTH
|
|
|
|
|
Tyrus182 wrote:
to convert the args into thier actual data from the va_list variable
I don't think there is a "ready-made" method to to that!
You will have to manage it within your code. Mostly you would be aware as to which position you would be expecting what kind of parameter... Using that you will have to build your arguments list with all the various data types you use.
Also you could provide option like:
C:\App\MyApp /i:3894 /f:489.24 /s:SomeName
Here when parsing you don't bother about the position of the parameter. You can just check for the "i: " and convert that to int, "f: " and use it as float, and "s: " to string.
Hope this helps.
- Nirav
* Don't wish it was easier, wish you were better! *
|
|
|
|
|
MSDN:
/* Returns the average of a variable list of integers. */
int average( int first, ... )
{
int count = 0, sum = 0, i = first;
va_list marker;
va_start( marker, first ); /* Initialize variable arguments. */
while( i != -1 )
{
sum += i;
count++;
i = va_arg( marker, int);
}
va_end( marker ); /* Reset variable arguments. */
return( sum ? (sum / count) : 0 );
}
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
well, i'm ashamed to ask this... i have a rich edit, i have initialized it properly, i've got the control and value variables here:
<br />
CRichEditCtrl m_REditDebug;<br />
CString m_REditDebugVal;<br />
how do i write to the rich edit?
m_REditDebug.insertstring or something??
i really couldn't find it!!
thanks for your help!
|
|
|
|
|
First you must init
AfxInitRichEdit()
in .h file you declare
CString m_strRichEdit;
with cpp file in DoDataExchange(CDataExchange* pDX) function
DDX_Text(pDX, IDC_RECONTROL, m_strRichEdit);
then you just do like that:
m_strRichEdit = _T("Try");
UpdateData(FALSE);
these steps you can do by wizard.
CRichEditCtrl also has another function
StreamIn: to load data from file to rich edit(MSDN)
|
|
|
|
|
i've done all the steps, i've got this function:
void CVentanaDebug::EscribirRichEdit(CString temp)
{
m_REditDebugVal = _T(temp);
UpdateData(FALSE);
}
and when i call it, i get an Debug Assertion Failed! error
any ideas?
thanks!
|
|
|
|
|
USE the :::
UpdateData(TRUE)
for CString m_REditDebugVal;
after asigning it a value
like
m_REditDebugVal = " hi how r u ? ";
UpdateData(TRUE);
hoping it will work;
|
|
|
|
|
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?
|
|
|
|