|
Finally I resolved the problems by dinamically alocating the "guilty" tables.
A final question. I didn't find in my "old" VC++6 how to use the
/STACK
option for the linker. Do you know how?
Thanks for all
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
RomTibi wrote: A final question. I didn't find in my "old" VC++6 how to use the
/STACK
option for the linker. Do you know how?
I don't remember where it's at in VC6. Should be somewhere in the linker
settings for your project - look for a stack size option
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
OK Thanks!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
During the creation of my Combo Box I entered the data into it for selection of the User. How do I find out what the User selected?
Please provide some code please.(VS 6.0 and VS 2008 C++)
A C++ programming language novice, but striving to learn
|
|
|
|
|
Do you want to get value or focus on combobox?
|
|
|
|
|
When the user changes the selected item, the parent will receive a CBN_SELCHANGE
notification (in a WM_COMMAND message). In response to that notification,
or at some other time you need the selected item from the combo box, you
could do something like this:
LRESULT SelectedIndex = SendMessage(hwndComboBox, CB_GETCURSEL, 0, 0);
if (CB_ERR != SelectedIndex)
{
LRESULT StringLength = SendMessage(hwndComboBox, CB_GETLBTEXTLEN, SelectedIndex, 0);
TCHAR *pSelectedString = new TCHAR[StringLength + 1];
SendMessage(hwndComboBox, CB_GETLBTEXT, SelectedIndex, (LPARAM)pSelectedString);
delete[] pSelectedString;
}
All Windows controls have associated messages used to manipulate them. Unless you
have them all memoized, I recommend keeping a link to this: Windows Controls[^]
or know where to find it in your local documentation.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hey!
Well i dun ve visual studio 08. But i can provide you a help in visual studio 6.0.
Now as you have already entered data to the combo box.Add new variable for the Combo Box in class wizard. it can be of type VALUE or CONTROL. Let it be VALUE and type CString. This variable will hold the data present in the Combo Box.Let the variable is ComboBox_Variable.
Now to check what user has selected, you can put a simple event in your program which will help in finding what user has selected from the box.
so you can add a button which will show a simple messagebox depending on the combo box data. Like a button named "Message".
Add an event handler for it and you can use the following code.
<br />
CString example;<br />
example = ComboBox_Variable;<br />
if(example=="Data-1")<br />
MessageBox("Data-1 selected by user");<br />
else if(example=="Data-2")<br />
MessageBox("Data-2 selected by user");<br />
You can use switch statement too!
I hope Combo Box will be clear to you now!
|
|
|
|
|
I have DVD-Compliant Mpeg-2 Files that I am interested in "turning" into .Vob files.
I know that these are basically the same and that the difference is in the "headers" of these two file types.
All of the Third-Party SDK's i have found demux and remux the mpeg before converting it to .vob.
I know that there are open-source libraries that create vob files and unofficial specifications for .vob files but for something so simple how can there not be a library or sdk that can save me the troubles?
Bottom line - I am looking for Code\module\dll\sdk that converts Dvd-Compliant Mpeg-2 files to .vob files.
Thank you,
Michael Mimouni
Witech Developer
mjmimmm@hotmail.com
|
|
|
|
|
class Text {
public:
void bad( const string &parm ) const;
private:
char *_text;
};
void Text::bad( const string &parm ) const
{
_text = parm.c_str(); // error: _text cannot be modified
for ( int ix = 0; ix < parm.size(); ++ix )
_text[ix] = parm[ix]; // bad style but not an error
}
this example show a pointer refer change a data member in the
const member function , why?
|
|
|
|
|
the function is declared as const (void Text::bad(const string& parm) const; ), that means that it is not allowed to modify any members of the Text class.
exception is with the mutable members however.
modified on Sunday, December 09, 2007 11:13:17 AM
|
|
|
|
|
_text is a char*. The const member promises not to change any of the member variables. Your first assignment changes _text to point to a different string. The second assignment (in the loop) does not change _text, but the content of the string that _text points to (btw, I assume that _text has been assigned to a valid string at some point in code not shown, otherwise the second assignment will corrupt your memory).
const pointers can point to mutable objects. You may change content of the object, but not the content of the pointer.
Cheers
Steen.
"Are you gonna check your makeup when you're done whining?" John Simmons, 05/31/2006
"Of course, the next day it automatically updates, and your quick'n'dirty patches cause the new binaries to segfault all over your linoleum. If only you'd had the source..." Shog, 10/18/2006
"One day I realized that sadness is just another word for not enough coffee" Wally, 10/18/2006
|
|
|
|
|
Hello,
I have run this logic on turboc++ 3.0 and it is working fine on it but
its not running on msvs2008 c++.
the code does this::
the fun strrep takes 3 char arrays the i.e main,sub,rep.
the sub array is to be found out i the main array and if found its index is taken on found pos,(this is achieved by the searchsub function separately)
then the sub array is replaced in the main array by the rep array,and the rep array can be of different size from the sub array.
i am not able to assign the value like this *temp=*main,where main and
temp are char pointers.
there is a runtime access violation error on msvs..that i am not
able to work out how to resolve..
kind attention and feedback would be invaluable for me...
thanks...the code is as below..
<code>// C++Test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "iostream"
using namespace std;
int i;
int searchsub(char mainstr[],char fndstr[])
{
int mainlen=0,sublen=0,flag=-1,index=0;
for( i=0;mainstr[i]!='\0';i++)
mainlen++;
for( i=0;fndstr[i]!='\0';i++)
sublen++;
for(i=0;i<mainlen;i++)>
{
index=i;
if(mainstr[i]==fndstr[0])
{
for(int k=0;k<sublen;k++)>
{
if(mainstr[i++]!=fndstr[k])
{
flag=0;
break;
}
else flag=1;
}
if(flag==1)
break;
i=index;
}
}
if(flag==1)
return index;
else return -1;
}
char * strrep(char * main,char* sub,char* rep)
{
int sublen=0,mainlen=0,replen=0;
char* save=main;
char*temp;
for( i=0;*rep!='\0';i++,rep++)
replen++;
rep=rep-i;
int index=searchsub(main,sub);
for( i=0;*sub!='\0';i++,sub++)
sublen++;
sub=sub-i;
int reststrindex=index+sublen;
main=main+reststrindex;
for(i=0;*main!='\0';i++,temp++,main++)
*temp=*main;
*temp='\0';
main=main-i-reststrindex;
int templen=0;
temp=temp-i;
for( i=0;*temp!='\0';i++,temp++)
templen++;
temp=temp-i;
main=main+index;
for(i=index;i<index+replen;i++)>
{
*main=*rep;
main++;
rep++;
}
for(i=0;i<templen;i++)>
{
*main=*temp;
main++;
temp++;
}
*main='\0';
main=save;
return main;
}
int _tmain(int argc, _TCHAR* argv[])
{
cout<<strrep("Abcdefghijk","cde","peternorton");
return 0;
}</templen;i++)></index+replen;i++)></sublen;k++)></mainlen;i++)></code>
|
|
|
|
|
how to post codes on this forum...my code is converting into html tags...
please look for this question on this link instead...
http://groups.google.com/group/comp.lang.c++/browse_thread/thread/dddfd4d4b8098a4b#ce1679dc10ec66c0
thanks..
|
|
|
|
|
After you have written your question, select the code then click on the CODE label, below the Text entry window.
This causes the selected text to be treated as code.
|
|
|
|
|
Your code has two major problems: it tries to modify a literal string ("Abcdefghijk") and it will overwrite the area allocated for main if rep is longer than sub . Try this instead:
std::string& strrep(std::string& main, const char* sub, const char* rep) {
if(sub && rep) {
std::string::size_type idx = main.find(sub);
if(idx != std::string::npos) {
return main.replace(idx, strlen(sub), rep);
}
}
return main;
}
|
|
|
|
|
Thanks for replying markkuk,
Firstly i dont want to use any of the inbuilt functions.
secondly why cant i increase the memory space for the main char pointer if the rep>sub,as i think that pointers do give a programmer this ability.. or should i allocate a new memory space using new operator and then carry out the operations on main pointer??
and why this can be done without errors on turbo c++ 3.0 and not in msvs2008 c++??
thanks for showing interest and helping.
|
|
|
|
|
If I try to add some thing in my sample project the error displays like this:-> c:\documents and settings\administrator\desktop\mitumori\mitu\jpeg.h(21) : error C2370: 'kJFIF' : redefinition; different storage class
|
|
|
|
|
keyto wrote: error C2370: 'kJFIF' : redefinition; different storage class
See here.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi, if I start up a new dialog using DialogBox, how do I get access to its message pump (GetMessage, PeekMessage, or whatever it uses)? This is without MFC.
The problem is that I have a dialog that I load up that has a lot of other controls on it, and I need to access the messages for those controls specifically (like catching a WM_MOUSEMOVE on a listbox, etc).
Thanks!
KR
|
|
|
|
|
KellyR wrote: I have a dialog that I load up that has a lot of other controls on it, and I need to access the messages for those controls
You can subclass the controls you want to intercept messages for:
Subclassing Controls[^]
This can be done in your dialogproc in response to WM_INITDIALOG.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
I found the default wrapping behavior by Graphics::DrawString to be incompatible with the wrapping behavior of some legacy apps and it was impossible to achieve some other required functionality without resorting to handling the wrapping manually.
With that said, I am having a rough time with the fact that GDI+ insists on measuring the '\n' character during output. This makes paragraph output, centered aligned, come out a bit off. I can remove the StringFormatFlagsMeasureTrailingSpaces flag but then any trailing spaces do not get measured. This is a word processor so text selection measurements must match the text output for text selection feedback.
Is there a way, without drawing each line individually, to somehow get GDI+ to ignore the '\n' character in measurements and when calculating center alignment but to still wrap on them? Is there another "newline" character that gets measured with a zero width?
|
|
|
|
|
Hello,
This article here: http://www.codeproject.com/KB/miscctrl/AppControl.aspx shows how you can host external window on your application if you have handle to the window. It uses this piece of code to host the window:
SetParent(appWin, this.Handle);
SetWindowLong(appWin, GWL_STYLE, WS_VISIBLE);
What I want to do is to be able to release the hosted window after some time. In order to do that I use GetParent() function to get handle of previous parent and then restore it again but I'm stuck with SetWindowLong part. Any ideas?
Thanks
|
|
|
|
|
SetWindowLong() returns the previous value of the one you set.
You could save that returned value and restore it when you
release the window...
LONG OldWindowStyle;
...
OldWindowStyle = SetWindowLong(appWin, GWL_STYLE, WS_VISIBLE);
...
SetWindowLong(appWin, GWL_STYLE, OldWindowStyle);
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
am writting a C++ application and I need to access my resource file really i use function
LoadLibrary() and it returns ahandle to the dll successfully but when I use the function
FindResource() and give it the resource id that I want to use it returns NULL, although when i use GetLastError() it tells that function endded successfully !!!.
Here I wanna tell something this code is successfull code when I use it on concole application, but when I write it on the citrix endpoint analysis SDK and generate the exe file when I run the exe simply it gives that FindResource() returns NULL,
Please can any one help???
1 - can i pass the exe name to LoadLibrary() ??
2 - FindResource problem ?? 
|
|
|
|