|
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
|
|
|
|
|
Hi,
how can i show an existing image in a c++ window. I mean i want my code to open a window and display an existing image in that window.
In a future work i will try to show an image sequence in that window.
For example, i have image001.bmp, image002.bmp,.. image016.bmp.
I want to open a window and display the images as a slide show in that window. Maybe going to the next image can be assigned to pressing a key on the keyboard. Or maybe a time feature could be used. I mean, in the window, existing images will be displayed each 0.5 seconds with the same order in the sequence.
Could someone help me with an explanatory piece of code?
Thank you ...
|
|
|
|
|
Look at the SDK documentation for the GDI function BitBlt(....)
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
i am creating one file "student.txt" with some fields, and i want to display that file with some fileds and one condition, how to?
-----------------
class student
{
char name[25];
char studentid[25];
chat city[25];
friend istream &operator>>(istream &stream, Student &st);
friend ostream &operator<<(ostream &stream, Student st);
};
ostream &operator<<(ostream &stream, Student st)
{
stream<<st.name <<"\n";
="" stream<<st.studentid="" stream<<st.city<<"\n";
="" return="" stream;
}
istream="" &operator="">>(istream &stream, Student &st)
{
stream>>st.name;
stream>>st.studentid;
stream>>st.city;
cout<<"/n";
return stream;
}
main()
{
Student stud;//student is class
fstream stu_file("Student.txt", ios::in | ios::out|ios::app);
cin>>stud;
stu_file << stud;// saveing in to the file
.........
stu_file.seekg(0, ios::beg);
while(!stu_file.eof())
{
if(!stu_file.eof())
if(stu_file.get(city) == "berlin" )
{
cout<<"Name"<
|
|
|
|
|
Hi,
I have a problem regarding embedded dlls (managed and unmanaged).. Could you help me please ?
My problem is the following..
- my target is a Pocket PC
- I want to export an unmanaged dll that I've done using Embedded Visual C++ 4.0 and wrap it with a managed dll written in C++. My unmanaged class is :
header :
--------
#ifdef UNM
#define DLL_API __declspec(dllexport)
#else
#define DLL_API __declspec(dllimport)
#endif
class DLL_API DLLUnmanaged
{
public:
DLLUnmanaged();
DLLUnmanaged(const char * const);
~DLLUnmanaged();
const char * getstring() const {return str;}
char * suffix(int n);
private:
char * str;
unsigned short len;
};
cpp:
#include <windows.h>
#include "stdafx.h"
#pragma warning( disable : 4091 )
#include "UnmanagedDLL.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
DLLUnmanaged::DLLUnmanaged()
{
str = (char *)LocalAlloc(0, sizeof(char));
str[0] = '\0';
len = 0;
}
DLLUnmanaged::DLLUnmanaged(const char * const str0)
{
len = (unsigned short)strlen(str0);
str = (char *) LocalAlloc(0, sizeof(char)*(len+1));
for(unsigned short i = 0; i < len; i++)
str[i] = str0[i];
str[i] = '\0';
}
char * DLLUnmanaged::suffix(int pos)
{
unsigned short suffix_length;
pos--;
if (pos < 0) pos = 0;
suffix_length = len - pos + 1;
if (suffix_length > 0)
{
char * suff = new char[suffix_length];
for(unsigned short i = pos; i < len+1; i++)
suff[i - pos] = str[i];
return suff;
} else
return 0;
}
DLLUnmanaged::~DLLUnmanaged()
{
LocalFree(str);
len = 0;
}
- I want to use the managed extensions of Visual Studio .Net like this :
#using <mscorlib.dll>
using namespace System;
#include <iostream>
using std::cout; using std::endl;
#include "path.../UnmanagedDLL.h"
public __gc class DLLManaged // to avoid using "DLLImport"s..
{
public:
String * find_suffix(String * s, int pos)
{
int length = s->Length;
char * in_string = new char[length+1];
for(unsigned short i = 0; i<length; i++)
{
in_string[i]="(char)s-">Chars[i];
}
in_string[length] = '\0';
DLLUnmanaged * s0 = new DLLUnmanaged(in_string);
delete [ ] in_string;
return s0->suffix(pos);
}
};
... so here is what I've done when doing it only with Visual Studio .Net. I've added to the solution (that has got the unmanaged (I took "DLL MFC") and managed (I took ".Net DLL") ) a C# windows application that simply references the managed dll. All that works fine..
but if I want to make a project like this (actually the unmanaged dll that I use is a bit more complicated that the one I gave you) for a Pocket PC I encounter a lot of problems (please don't blame me, I'm a beginner!)
I tried to do it this way. The thing is that I don't know how to make an EMBEDDED MANAGED C++ DLL...
if I do the unmanaged project with Embedded Visual C++ 4, and if I make a .Net DLL similar to the one I've given to you upper, I get errors like:
ManagedDLL error LNK2020: jeton non résolu (0A000009) _CxxThrowException
ManagedDLL error LNK2020: jeton non résolu (0A00000B) delete
ManagedDLL fatal error LNK1120: 2 externes non résolus
(sorry, I've the French version of VS .Net)
obviously the linkage goes wrong..
So..what is the thing I've to do ? could you help me please, since I'm trying to fix the problem for many days now!
thanks to pay attention to it,
Julien (IT student)
|
|
|
|
|
hi
i try to write program for installing RamDrive Driver by using SetupAPI Function , but i can't Because i have not Good Sample code or Document about SetupAPI Functions ,like SetupInstallFile and ...
please help me
mtaghiloo@yahoo.com
majid taghiloo
|
|
|
|