|
I found that using an Icon on a button worked better than a bitmap (but the process is very similar.)
I used the examples in the MSDN library (VC6 version) The SDK-level code I used is something like this:
hwndMyButton = CreateWindow("button", "",<br />
WS_CHILD | WS_VISIBLE | BS_ICON | BS_PUSHBUTTON,<br />
buttonPosX, buttonPosY, ButtonWidth, ButtonHeight,<br />
hwnd, (HMENU)ID_ButtonID, hAppInst, NULL);<br />
<br />
hButtonIcon = LoadIcon(hAppInst, MAKEINTRESOURCE(IDI_ButtonIcon));<br />
<br />
SendMessage(hwndMyButton, BM_SETIMAGE, (WPARAM)IMAGE_ICON,<br />
(LPARAM)(HANDLE)hButtonIcon);
I later changed to using a toolbar, because that looks more modern than Icons or Bitmaps on buttons!
|
|
|
|
|
|
|
HI.
Plz tell me how can i add a resource(BITMAP) in my resources ... i tried it my right clicking on resources then click on insert then choose a bitmap and select from proper drive.,, it is inserted in my resources but only a blank white sapce ...
plz tell me proper way
thanx
|
|
|
|
|
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.
|
|
|
|