|
As long as a pointer doesn't point to a class, you can convert it from anything to anything. Unless you don't know what you are doing, you will get away with it.
The serial class that you are using is a good one. I use it too in one of my programs. So the problem is definitly not there.
Your problem however, is that you don't pass the number of bytes in the buffer (pszData) to your SortData function. You have that number, since the serial class demands a buffer size for the read actions. I suggest that you use those values to determine how much data is recieved.
tomek18 wrote:
At the moment I am having problems converting Data types. Pointers, Strins, LPCTST, etc... I don't understand them much. And everytime I try a method I get an error saying something like: cant convert pointer to string vice versa.
Use static_cast<PointerType>(OtherPointerType) for this purpose.
I think that you are a little bit over your head with this project if you have problems like this. I suggest that you do some more reading about data types, pointer arithmic and such. The basics should be enough to get the job done.
Good luck with it.
P.S.
If you have some problems with something, by all means, ask and post the source code too! Otherwise we will not be able to help you much...
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
tomek18 wrote:
Basicaly pszData is only 1 character at a time.
While the compiler couldn't care less, and it certainly is not required, you might want to consider a different variable naming convention so that you and others who read your code can make better sense of it. See here.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
i debug my program, and the exception (unhandled exception in gis.exe(MFCO42D.DLL):0xc0000005 access violation.) arised when the instruction(mapinfo.CreateDispatch("MapInfo.Application"))run. how can i deal with it?
|
|
|
|
|
It is the debug version of the MFCOLE Shared Library.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
how can i deal with the problem?
|
|
|
|
|
Well, either mapinfo is not a valid COleDispatchDriver object, or "MapInfo.Application" is not a valid automation object identifier. I'd have to see more of your code to know for sure.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
liuyue wrote:
mapinfo.CreateDispatch("MapInfo.Application"))
Please Check that mapinfo variable hold valid reference to memory
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
hello,
i need to know who to determine whether a user is logged on or not. i have already tried GetUserName but this didn't work, because i have a service running as 'system', so GetUserName only returns 'system'. Now, how can i get this information ?
OS: Windows 2000
Thanks in advance.
|
|
|
|
|
Check out the UserName property of Win32_ComputerSystem .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
If this is Windows 2000 and you think they will always launch the shell you could simpy enumerate processes looking for explorer.exe or whatever they replaced the shell with.
Alternatively you could write a Winlogon Notification DLL which gets notified of events such as Logon and Logoff.
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
thanks for the hints, but i have found another workaround. because i have already a process which gets launched at startup - i simply put a pipe in it, which delivers the needed informationen whether a user has logged on.
thanks anyway.
|
|
|
|
|
actually i want to open number of files at same time and at each time when ill click on "openfile" on "file" menu a check box would be created for each file. On each open file action check box would be created on group box next to previous one.
how can i do this?
|
|
|
|
|
softtec wrote:
how can i do this?
Do what? Open a number of files at the same time? Create a checkbox for each opened file? Add to a menu? What group box?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
actually i have created a menu
when i click openfile on File menu, a checkbox is created in groupbox right
but it works only when i open single file
as i click openfile menu i got assertion error
now i want whenever i click on open file menu,check box is created
and if i again click on open file menu another checkbox will be created just below the previuos one in the same groupbox.
|
|
|
|
|
softtec wrote:
a checkbox is created in groupbox right
What groupbox?
softtec wrote:
as i click openfile menu i got assertion error
What line of what file is asserting?
Are you using MFC?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
CButton b;
CRect rect;
rect.SetRect(20,20,200,40);
b.Create(name,WS_CHILD | WS_VISIBLE | BS_CHECKBOX | BS_AUTOCHECKBOX,rect,&m_Stat,2)
where CButton m_Stat;is variable connected to GroupBox
|
|
|
|
|
I have Proj.exe + Proj.exe.manifest
Proj.exe calls foo.dll
Question: How can I disable influence of manifest on foo.dll
May be there is some compilation keys which can explicitly tell to use ComCtrl32.dll version 5 instead of 6(support XP styles)
Another words foo.dll should not use XP styles enabled in manifest but Proj.exe should
Thanks
We yesterday got drunk with Bacchus ...
|
|
|
|
|
Guys do you think it could help?
If you do not define this macro in your project, it is automatically defined as 0x0500. To define a different value, you can add the following to the compiler directives in your make file; substitute the desired version number for 0x0400.
/D _WIN32_IE=0x0400
Another method is to add a line similar to the following in your source code before including the Shell and Common Control header files; substitute the desired version number for 0x0400.
#define _WIN32_IE 0x0400
#include <commctrl.h>
Version Description
0x0200 The application is compatible with Comctl32.dll and Shell32.dll version 4.00 and later. The application cannot implement features that were added after version 4.00 of Comctl32.dll.
0x0300 The application is compatible with Comctl32.dll and Shell32.dll version 4.70 and later. The application cannot implement features that were added after version 4.70 of Comctl32.dll.
0x0400 The application is compatible with Comctl32.dll and Shell32.dll version 4.71 and later. The application cannot implement features that were added after version 4.71 of Comctl32.dll.
0x0401 The application is compatible with Comctl32.dll and Shell32.dll version 4.72 and later. The application cannot implement features that were added after version 4.72 of Comctl32.dll.
0x0500 The application is compatible with Comctl32.dll version 5.80 and later, and Shell32.dll and Shlwapi.dll version 5.0 and later. The application cannot implement features that were added after version 5.80 of Comctl32.dll, or version 5.0 of Shell32.dll and Shlwapi.dll.
0x0501 The application is compatible with Comctl32.dll version 5.81 and later, and Shell32.dll and Shlwapi.dll version 5.0 and later. The application cannot implement features that were added after version 5.81 of Comctl32.dll, or version 5.0 of Shell32.dll and Shlwapi.dll.
0x0600 The application is compatible with Comctl32.dll version 6.0 and later, and Shell32.dll and Shlwapi.dll version 6.0 and later. The application cannot implement features that were added after version 6.0 of Comctl32.dll, or version 6.0 of Shell32.dll and Shlwapi.dll.
We yesterday got drunk with Bacchus ...
|
|
|
|
|
What do you mean by "a cleaner way?"
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I'm still unclear as to what you are asking.
http://www.codeproject.com/dll/[^]
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
As in make the Code shorter more proffesional or more appealing ?
I cant think of another shorter method to do this.
I cant use Class Items like stated on the link you send me.
|
|
|
|
|
Given that it's hard to tell what your code is even doing, it's impossible for me to offer any suggestion(s). Does it solve the probem it was meant to solve? If so, why are you wanting to mess around with it? If not, what are you using to confirm its inefficiency?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
is there any wrong in the fallowing code bcoz it cannot found file
CFile LogFile("E:\\log.txt",CFile::modeCreate||CFile::modeWrite||CFile::modeNoTruncate||CFile::typeText);
LogFile.SeekToEnd();
LogFile.Write(fname,sizeof(fname));
LogFile.Close();
where fname is of type CString.
|
|
|
|
|
CFile LogFile("E:\\log.txt",CFile::modeCreate||CFile::modeWrite||CFile::modeNoTruncate||CFile::typeText)
The problem is ||
Do this :
CFile LogFile("E:\\log.txt",CFile::modeCreate | CFile::modeWrite | CFile::modeNoTruncate | CFile::typeText)
Bonne chance
|
|
|
|
|
softtec wrote:
CFile LogFile("E:\\log.txt",CFile::modeCreate||CFile::modeWrite||CFile::modeNoTruncate||CFile::typeText);
Given that you used || instead of | , the second parameter is evaluating to 1, which is the same thing as CFile::modeWrite . That's why the file does not get created.
Also, the CFile::typeText flag is ignored with CFile objects. It's used with derived classes only.
softtec wrote:
LogFile.Write(fname,sizeof(fname));
This should be LogFile.Write(fname, fname.GetLength() * sizeof(TCHAR)) instead.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|