|
I want to use a FileNameEditor in which you can select only bitmap files, so I overloaded FileNameEditor, and in the InitializeDialog function, I set the Filter member to only show bitmap files. But this doesn't work. It does work fine when I just specify FileNameEditor as editor, but even when I only overload the FileNameEditor into a new class, without even adding any members, it doesn't work. I have done this before, in c#, and there it worked perfectly, and the managed c++ version doesn't work. There just isn't an ellipses button in my property grid.
The c# class that worked fine:
class ImageFileEditor : FileNameEditor
{
public ImageFileEditor()
{
}
protected override void InitializeDialog(OpenFileDialog dlg)
{
dlg.Title = "Select Image";
dlg.Filter = "Bitmap Files (*.bmp)|*bmp";
}
}
and the managed c++ version that doesn't work:
__gc class ImageFileEditor : public FileNameEditor
{
public:
ImageFileEditor()
{
}
protected:
virtual void InitializeDialog(OpenFileDialog *pDlg)
{
pDlg->Title = S"Select Image";
pDlg->Filter = S"Bitmap Files (*.bmp)|*.bmp";
}
};
And this is the property that should use the ImageFileEditor. If I change ImageFileEditor to FileNameEditor it works fine though.
[Category(S"Base Texture"),
EditorAttribute(__typeof(ImageFileEditor),__typeof(UITypeEditor))]
__property String* get_BaseImageName()
{
return pBaseImageName;
}
__property void set_BaseImageName(String *value)
{
pBaseImageName = value;
}
How should I do this?
Thank you
|
|
|
|
|
Hi,
I am writting the Huffman code algorithm now, I have built the huffman tree and stored the
corresponding binary string for each character ( 0-255)into a string array named arr_code, and got a list of binary string for the input file. my question is how can I transfer the binary string into
bit size then get it compressed?
Thanks!
|
|
|
|
|
I would pad the string with zeros up to length which can be divided by 8. And then I would read each time 8 characters and convert it into byte let's say by multipling already calculated part and adding value of a new bit character or by using << operator.
I hope this helps
DavidR
|
|
|
|
|
Thanks so much for your reply. I already finished this program last week. Now I am reading the "rice coding" algorithm if I have any question, I will post the question here. Thank you again!
JJ
|
|
|
|
|
I am just beginning to get into designing (hand-coding) forms with .Net using C++. I am trying to write a very simple application that has buttons on it and draws a black ball every 10 milliseconds that bounces around the screen which I plan to use to learn more about programming in .Net and as a reference for future programs. I placed every function and variable in a single class (except the main() function) that extends the Form class. I placed a call to Invalidate(), Update(), and Sleep(10) (in that order) in an idle function which I then used as the function to handle the Application Class's Idle event. The program does draw the black ball properly and does call the idle function but it only calls it after another event occures (such as when the mouse is moved over the form). I was wondering whether anyone could either tell me a way to fix this problem so that the black ball is drawn and moved every 10 milliseconds or provide me with a better way to do this. Any help on this would be greatly appriciated.
|
|
|
|
|
You could use a high resolution timer to drive the animation if you have hardware that supports it. Otherwise you could use a secondary thread that calls ::Sleep(10)
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Thank you very much for your prompt response but as I said, I am just getting started with .Net so could you please clarify exactly how I would do this. Thanks in advance for any help on this subject.
|
|
|
|
|
|
Thanks for the information and I tried implementing it in the paint event handler as shown below:
<br />
void formOn_Paint(Object* sender, PaintEventArgs* e)<br />
{<br />
...
Invalidate();
Update();
System::Threading::Thread::Sleep(10); Sleep for 10 milliseconds.<br />
}<br />
Unfortunately, this code makes the program run extremely sluggishly and I have a new computer with a Pentium 4 so I really doubt it is the hardware. I used to have this code done in the application's idle handler (the drawing and moving of the black ball was still handled in the Form's paint event handler) as shown below:
<br />
void onIdle(Object* sender, EventArgs* e)<br />
{<br />
Invalidate();<br />
Update();<br />
System::Threading::Thread::Sleep(10);<br />
}<br />
Both of these functions are members of the class that is used as the parameter to the Run() function of the Application class so the keyword 'this' is implied when referring to the functions Invalidate() and Update().
Thanks in advance for any help you can provide me with on this subject.
|
|
|
|
|
>> you could use a secondary thread that calls ::Sleep(10)
You are calling sleep in the primary or UI thread. That is NOT a secondary thread and it is just not going to work very well.
-pete
|
|
|
|
|
Thank you very much for your help, that solved my problem.
|
|
|
|
|
i need to know what the nFolder variable for the value "56" is in the function SHGetFolderPath
HRESULT SHGetFolderPath( HWND hwndOwner,
int nFolder,
HANDLE hToken,
DWORD dwFlags,
LPTSTR pszPath
);
i browsed msdn, but there was no variable with such value,
pls help
thanks in advance
|
|
|
|
|
from ShlObj.h
#define CSIDL_RESOURCES 0x0038 // Resource Direcotry
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
my problem is disassembling managed c++ assemblies, so that when i try to re-compile the IL i don't get errors for functions, containing 'modopt' in their name.
If you can, please tell me how to disassemble such .net assemblies.
Thanks in advance,
Stan
|
|
|
|
|
Do you have a code sample that reproduces the problem? It sounds like a possible ildasm bug.
Matt
Visual C++ FE
|
|
|
|
|
the assembly is just a managed c++ dll. when i disasemble it using ildasm, and (try) to re-assemble it with ilasm, the error functions' names both have 'modopt' and double dots.
i do think it's bug, too.
|
|
|
|
|
Anything special about the functions that error? I'll check the bugbase.
Matt
|
|
|
|
|
well, i think some of the functions are native, and that's the prob
|
|
|
|
|
Hi friends i am new to c++ and also in the forum this question is my
experiment .Now problem is that , i want to change the while loop to
the nested for loop.
The program's description is as follows :-
Writ a program for a Match stick game between the computer and user .
Program should ensure that the computer always wins .
Rules for the Game are as follows:-
-There are 21 match sticks.
-The computer asks the player to pick 1, 2 ,3, or 4 match sticks .
-After the person picks , the computer does its picking .
-However is forced to pickup the last match stick looses the game .
The programs code is as under
/*Match Stick Game */
# include <stdio.h>
# include<conio.h>
void main ()
{
int m = 21,p,c;
clrscr();
while(1)
{
printf("\n\nNo.of matches left = %d",m);
printf("\npickup 1,2,3,or 4matches");
scanf("%d",&p");
if(p>4||p< 1)
continue;
m = m -p;
printf("\n\nNo. of matches picked up %d",c);
m =m-c;
if(m== 1)
{
printf ("\n\nNumber of matches left %d" ,m);
printf("\nYou lost hte Game !!");
break;
}
}
printf("\n\n\n\n\nPress any key to Exit...");
getch();
}
|
|
|
|
|
This sounds like homework to me
----------
int Value;<br />
<br />
for (int i = 21; i > 0; i=i)<br />
{<br />
Console::WriteLine("Pick 1,2,3 or 4: ");<br />
Value = Console::Read();<br />
<br />
if (Value <= 4 && Value >= 1)<br />
i = i - Value;<br />
else<br />
Console::WriteLine("Not a valid choice");<br />
<br />
if (i <= 0 )<br />
Console::WriteLine("Game over");<br />
}<br />
<br />
<br />
Console::WriteLine("Press enter to continue");<br />
Console::Read();
|
|
|
|
|
i am having issues while writing a file renamer program using borland c++. The problem is I can not replace non-unicode char to the unicode ones, for example i (not i) borland doesnt even let me to declare non-unicode chars.
If somebody has a clue or exprienced this before, please let me know.
Thnx...
Ilker TANLI
www.tanli.net
|
|
|
|
|
Hey Guys,
I've been looking at things around the Internet and i'm seeing this:
String* s = S"Hello World!";
the 'S' that precedes the string, what does that do? Is it the same as the @ modifier in C#?
Thanks,
Adam
-- Adam
"If you can't beat your computer in chess, try kickboxing"
|
|
|
|
|
|
I am in a migration project of conversion of COM components written in VC ++ to either Managed VC++ or C#.
Can anyone suggest me how to proceed with this.
Client wants to the development team to use some migration tool and convert it and after that rectify some minor errors and modifications.
I tried open the VC++ project in the MS Visual Studio.Net, but when I tried to build, it didn't worked out giving multiple errors for the header files.
Please suggest as I need to give some solution at the earliest.
|
|
|
|
|
If the design was done properly it should be a simple job to remove the COM layer and replace it with a Managed class or multiple classes that expose the native C++ classe(s) of the project.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|