|
you mean using a bitmap button ?
TOXCCT >>> GEII power
|
|
|
|
|
I have a program which communicates with a GSM modem. I have used non-overlapped communications, so I have two threads, one which reads the port, and other which writes. I also want to use the WaitCommEvent function, to wait in the read thread the arrive of new data. The problem, is that if I want this functions correctly, I must write the command before the read thread come to the WaitCommEvent function. Why???? I could block the read thread befor de WaitCommEvent statement till I write, but if a RING command, for example, arrives at the port, this doesn't realise, so this is not a good solution.
Can somebody help me??
Thanks
|
|
|
|
|
why?
Sometime after compile a dll project, a ".lib" file has been built but sometime it was not built?
Thanks
|
|
|
|
|
I got string like this :"Rassul##Rasul#Yunussov";
And i want to tokenize it to strings : "Rassul" and "Rassul#Yunussov".
I know the function strtok - but it doesnt distinguish "##" from "#".
|
|
|
|
|
you have to get the # character from the string, and test its following character.
i'm about to post an article about something like that (parsing streams)... wait a bit (posted)
here is a like on parsing code : Visual Calc - A new dimension for the desktop calculator[^]
<font style="color:blue;">char</font> ch = str[NextChar++]; <font style="color:green;">
<font style="color:blue;">switch</font> (ch) {
<font style="color:blue;">case</font> <font style="color:purple;">'#'</font>:
{
<font style="color:blue;">char</font> nch = str[NextChar++];
<font style="color:blue;">if</font> (nch == <font style="color:purple;">'#'</font>) {
<font style="color:green;">
}
<font style="color:blue;">else</font> {
<font style="color:green;">
NextChar--;
}
<font style="color:blue;">break</font>;
}
<font style="color:blue;">default</font>:
<font style="color:green;">
}
TOXCCT >>> GEII power
|
|
|
|
|
Perhaps its wiser to choose a different form of formatting your strings. Why use '##' and '#', they already cause problems trying to distinguish them during parsing. How about using '$' and '%' or something like that. '##' and '#' clearly mean different things to you, so why use such similar signs?
Er zit een korstje op mijn aars.
|
|
|
|
|
If you're using MFC, use CString::Find() to find "##".
[insert witty comment here]
bdiamond
|
|
|
|
|
How about:
char *str = "Rassul##Rasul#Yunussov";
char *pos = strstr(str, "##");
char left[16], right[16];
strncpy(left, str, pos - str);
strcpy(right, pos + 2);
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi,
I need to get Unicode Values for characters of a Custom Font.
can anyone point me to some resources?
Thanks
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
I don't know, what is a Custom font. But generally, if you want to convert characters from Windows-125* (depending of localization of the OS) to Unicode encoding, use mbstowcs() function.
Robert-Antonio
"Love, truth and electric traction must gain victory over hate, lie and
diesel traction."
|
|
|
|
|
Thanks, I'll look that up....
What I meant by Custom font is an installed True Type font.
I have to read some data from an Excel file and write it as XML. Now the excel file uses this TTF for Devnagari Script. It contains Hindi characters. I have to convert these into Unicode if they are to be shown correctly in the XML (Or is there another way?)
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
Do you have the Devangari charset in your Windows localization?
Robert-Antonio
"Friends come and leave, but teddybears stay in forever."
|
|
|
|
|
Yes I do
"It was when I found out I could make mistakes that I knew I was on to something."
-Ornette Coleman
"Philosophy is a study that lets us be unhappy more intelligently."
-Anon.
|
|
|
|
|
So it's simple. If the Devangari charset is default on your system, use mbstowcs . When not, use MultiByteToWideChar , where you supply the Devangari charset codepage number. See MSDN for details about these functions.
Robert-Antonio
|
|
|
|
|
Hello:
I have MFC Dialogue based application , In the application I need to check the system time say for (12:00 AM) while the application is running , to do some code . I see that i should use worker threads , I read about it and tried to implement but with no avail.
I will wrote what i did :
in OnInitDialog()
_beginthreadex(NULL,0,myThread,NULL,0,0);
and my thread is :
UINT uCheckTime(LPVOID)
{
CCriticalSection cs;
cs.Lock();
SYSTEMTIME SystemTime;
GetSystemTime(&SystemTime);
DWORD dwHour = SystemTime.wHour + 2 ;
if(dwHour >= 13 )
{
//Do some work......
}
cs.Unlock();
return 0;
}
here this thread never fired!!
What can I do ?
Regards
|
|
|
|
|
Hi,
TRY USING AfxBeginThread function. The first parameter to this function is name of thread function in your case uCheckTime.
Hope this will help you
SUjan
|
|
|
|
|
This is because your thread function exits before the condition ins met. What I think you want to do is:
UINT myThread(LPVOID)
{
while (!ExitCondition)
{
}
} where you have an exit condition set in your dialogs OnDestroy() or something like that.
Basically, you want the thread to execute as long as your app is. Your thread as it is exits after one pass.
|
|
|
|
|
Hello,
I, in my opinion, the way to go lies here...[^]
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
Hmmmm... Okay. Why is this the way to go? It looks like an interesting write up but I don't see an introductory statement explaining the purpose. Why not just use CWinThread since MFC already provides that in the library? MFC already provides interfaces for launching and managing threads using library functions.
Obviously, the original problem reported with this thread didn't have anything to do with a particular method for creating threads. It had to do with the thread function, simply being coded incorrectly. Since there was no loop, the thread would exit after one pass and it would appear to the casual observer that the thread never launched. I'm always open to new ideas but before I spend hours sorting through a long write up, it'd be nice to see a purpose statement that would entice me to believe that it is worth doing so.
|
|
|
|
|
Hello,
I'm currently working on my first multithreading application. At design stage, I spent hours looking for a simple way to manage threads. Since I don't want to stick to MFC too much, I couldn't use CWinThread.
IMHO CThread was the most complete (it even has a wizard to build your derived class) and simple class I could find.
I find my code more readable and manageble since all the thread dependant data is in one place.
Since you already solved your problem, I don't see why you should rewrite your code, but you when you work on an other multithreading application, you might find CThread as usefull as I do...
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
|
Hi
I'm a new starter of Codeproject in VC++ and working on list control. I'm very interested in the ReportControl written by BIN. I think it's useful to put it in my application. I try to add a new class with the same name with ReportCtrl class, and then copy all the line code in ReportCtrl.h, and ReportCtrl.cpp in those files of mine. After that I add a new member variable for my list control in my dialog with type CReportCtrl and I have this warning dialog: "Please ensure that XDlg contains the neccessary #include directives for using your class CReportCtrl(from the file "ReportCtrl.h" and I press OK. The member variable appears in the source code, then I compile the program. But I got these errors: :\temp\100304\1\1dlg.h(23) : error C2146: syntax error : missing ';' before identifier 'm_ctrlReport'
c:\temp\100304\1\1dlg.h(23) : error C2501: 'CReportCtrl' : missing storage-class or type specifiers
c:\temp\100304\1\1dlg.h(23) : error C2501: 'm_ctrlReport' : missing storage-class or type specifiers
1Dlg.cpp
c:\temp\100304\1\1dlg.h(23) : error C2146: syntax error : missing ';' before identifier 'm_ctrlReport'
c:\temp\100304\1\1dlg.h(23) : error C2501: 'CReportCtrl' : missing storage-class or type specifiers
c:\temp\100304\1\1dlg.h(23) : error C2501: 'm_ctrlReport' : missing storage-class or type specifiers
C:\Temp\100304\1\1Dlg.cpp(79) : error C2065: 'm_ctrlReport' : undeclared identifier
ReportCtrl.cpp
Couldyou tell me how to deal with this?
Thank you so much.
Thanks for reading!
|
|
|
|
|
add following line in 1Dlg.h
#include "ReportCtrl.h"
There is no spoon.
mail
|
|
|
|
|
Dear Friends,
I want to round the float/double value upto two decimal places and display in edit control. How can i do so.
Here is the scenario: I got an edit control on which a double variable is associated. I assign some value to this variable and call UpdateData(FALSE) . As such the edit control gets populated with the value, but value is appearing of the form 67.24678945. I want to get this value of the form 67.25 i.e rounded upto two decimal places.
Imtiaz
|
|
|
|
|
Hi,
Instead of associating a double variable with the edit control, use a CString variable. Before calling UpdateData(FALSE) use something like this strFloat.Format("%.2f", fFloatVal); where fFloatVal contains ur decimal value.
Regards,
Mahadevan
|
|
|
|