|
If what you're trying to do is store strings in a vector, here is what you have to do.
struct {
char flag,
unsigned char data[60],
}packet;
vector<string> vect_data;
int func(packet *p_packet)
{
vector.push_back(p_packet->data);
}
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
As superman said,
u need to use vector <string>. please change the structure as
syntax of structure defintion is wrong in your case so change as below
along with that, change the structure data as string to hold string data
struct
{
char flag;
string data;
}packet;
// There is no problem using vector, if u want sequence access to the data.
vector<<string>> vect_data;
int func(packet* pPacketData )
{
vector.push_back( pPacketData->data );
}
Величие Бога не может быть недооценена.
|
|
|
|
|
I recently converted a project from VC++6 to Visual Studio 2008. The project is an unmanaged DLL using MFC.
The problem I'm having is, when I run the project using Excel, using a tester I made to call the DLL and check return values, when the DLL should return false or true, based on certain calculations and conditions, the VS2008 project always returns true. Even using a "return false;" statement, the Excel tester gets a return value of true. In VC++6 it worked fine. Has anyone else seen this, or know of a way to fix it, or test futher to find the cause? Many Thanks!
The Code Demon Rises.
|
|
|
|
|
Have you tried debugging the DLL from within Visual Studio (most likely by attaching to the tester, if it's a process, or Excel, if it's hosting the tester library) and seeing exactly what's going on behind the scenes?
Adam Maras | Software Developer
Microsoft Certified Professional Developer
|
|
|
|
|
Is it returning a BOOL or a bool? I'll wager the DLL returns a bool (a one byte value), but Excel is looking at the value as an int (a 4 byte value.)
(The reason it may have "broken" is simply due to how the code was compiled between the two compilers since I've seen VC++ 6 display this behavior.)
|
|
|
|
|
To the first question, yes, that is why I built the Excel tester. That's how I know the 'return false;' statement does nothing.
To the second question, I actually have several DLLs that return in the same way, and some of them still work, while some of them get stuck returning true. On the BOOL vs bool, in the C++ code it's a 'bool' and in the tester it's looking for a VBA 'Boolean'. Though with some of the DLLs working correctly, and the others not, I don't think that has anything to do with the bug.
A soft glow comes from the pit in the darkness.
The clicking noise become faster - and louder.
A wind begins to stir up from the pit, as the
creature flexes it's wings, preparing for flight.
You stare into the pit, and hear a voice say
in your mind, "If you survive the encounter,
declare it to the world."
The Code Demon Rises.
|
|
|
|
|
I can't totally confirm this, but some sources state that a VBA Boolean is 4 bytes (another said it was 2 bytes).
|
|
|
|
|
Using Len() and LenB() in VBA, the size of a Boolean is 2 bytes. Here[^] it says the size of a C++ bool is 1 byte. For my problem, I can just return an int, 1 or 0, instead of true/false, and get around it. But Why would the size difference between bools cause this problem?
The Code Demon Rises.
|
|
|
|
|
A value is returned in the eax/ax/al register. Because a one byte bool only has to zero out the register al (xor al, al). The high bits of the [e]ax register may be set to a non-zero value.
|
|
|
|
|
Hi Everyone,
I am working on a MFC project in VS2008. I have a very long form which need scrolling. At the end of the form i used a data time control and when i select a dated at runtime. The form jumps to the start of the screen.
Did anyone face this kind of issue?
Any suggestions will be helpfull.
Regards,
Kasi
|
|
|
|
|
Hi All,
Seems that, despite the incredibly easy steps of getting HINTS (tool tips) going using ultimate grid, they don't seem to want to show up.
We have done the following:
1. Added UseHints(TRUE); to the OnSetup() func.
2. Wrote code to handle a tooltip in the OnHint() handler.
Could this be because the Grid is being put into an ActiveX control and there is some crazy windowing issue happening here?
Any help would be great,
Jt
|
|
|
|
|
Hi
want to create UGrid control as ActiveX or COm to use it from C#
can you help me out?
Thanks
CC
chetan
|
|
|
|
|
When an item in a treeview is selected it is colored blue. But if you set the focus on another control the selected item keeps selected but has no visual clue for this, you can't see which is selected. Is there a way to change the background of the selected item using WinAPI-function and/or C(++) only?
Thanks
Rozis
modified on Tuesday, July 28, 2009 6:02 AM
|
|
|
|
|
Try adding the TVS_SHOWSELALWAYS style to your tree control.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Simple and effective...
Thanks
|
|
|
|
|
Hi
I wanna set the fields value of a PDF file via MFC.
I know how to do it for MSWrod, but I have no idea how to do it for a PDF file
any idea?
www.logicsims.ir
|
|
|
|
|
i dont think it will be easy doing the PDF writing using MFC.
use the below mentioned library named libharu, it can used to read and write PDF files
http://libharu.sourceforge.net/[^]
all the best
Величие Бога не может быть недооценена.
|
|
|
|
|
Hey
I want to extract a string from a text file.
The file name is "info.txt"
Inside the text file there is a field called, "Age = 23"
Now i want to extract that "23" from the Age.
I know its easy to do that on an ini file, with its key name.
But how to do that on a text file.
|
|
|
|
|
If you're using MFC, you can use CStdioFile or CFile . With Win32, you could use ReadFile() or use the C++ stream functions as well. I'm picking the easiest and showing you an example:
CStdioFile csf;
CFileException cfe;
if(!csf.Open(_T("C:\\Temp\\rough.txt"), CFile::modeRead, &cfe))
{
AfxMessageBox(_T("Unable to open the file"));
return;
}
CString szBuffer;
csf.ReadString(szBuffer);
int nFind = szBuffer.Find(_T("="));
AfxMessageBox(szBuffer.Mid(nFind+1));
Contents of file:
age = 23
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I am changing my application to use the Feature Pack 2008 to get the new "look". One of the problems I ran into, is How to change the GetToolBarCtrl()? Here is a snippet:
CToolBar m_wndGraphToolBar;
CToolBarCtrl *pGraphToolBarCtrl;
pGraphToolBarCtrl = & m_wndGraphToolBar.GetToolBarCtrl();
pGraphToolBarCtrl->HideButton(nID, TRUE );
But when I change CToolBar to CMFCToolBar, I get: 'GetToolBarCtrl' : is not a member of 'CMFCToolBar' ?
How do I replace this? Anyone ran into this one?
Thanks
|
|
|
|
|
Hi,
Did you find the solution of this problem? I am also stuck with this problem.
|
|
|
|
|
Hi,
I want to know about mouse programming.Actually i want to do is that there is a *.docx file in my computer(windows-XP)and i have a c program which can read the content of *.docx file.so first i have to give input(the location of the *.docx file) to that C program then it can read the content of that *.docx file.I want that when i click on *.docx file then it will be input for that C program.So how can i do this???
Please help me.....
-Ravi Joshi wanna ask about mouse programming.............
|
|
|
|
|
Make a file assiocation telling when the user clicks on .docx-file your program is run (with the .docx-file as a commandline parameter).
Rozis
|
|
|
|
|
Hey Rozis .
The same thing i want to ask you that how do to that program in C? Please help me Please....if you have any website link or any C program of that type please give me or simply mail me in ravi2008joshi@gmail.com
|
|
|
|
|
I have buffer of data coming in and I will try to store in the as below struct would this work.
struct {
int flag,
char check,
vector<char> data,
}Packet;
Packet = Buffer; (assigning buffer information to Packet Struct)
Will vector will be assigned data auromatically or I have to use "push.back" inorder to get the data stored in vector...
THANKS!!!
|
|
|
|