|
Well,
I don't get it to work can you please send me some
code sample?
\Larsson
|
|
|
|
|
im making a game that is rendered by GDI+
however, standard GDI BitBlt's and even threads make the game window look very slow and i can see the refresh rate or whatever you call it when i render to the HDC
my question is... is it possible (and is there an example) of using GDI+ to render to a DirectDraw surface (ill probably use the latest DirectDraw or whatever is easier)
OR (even better)
is there a way for me to draw directly to the screen (without windows layer) like Windows Media Player and DirectX seem to do?
i know it would require some pixel-format conversions but i'm ready to work with that
any suggestions?
- Roman -
|
|
|
|
|
Ok i just got the windows media DRM SDK delivered to me from MS. I added it into my project and now i get a linker error.
error LNK2001: unresolved external symbol __ftol2
I also updated my MS Platform SDK a few dats ago (while i was trying to get a copy of the internet SDK , i didn't even want the upgrade)
I've searched and heard that __ftol2 may have something to do with managed C++ and or .NET , can anyone tell me how to get around this.
thanks.
Jared Allen.
www.chironexsoftware.com
|
|
|
|
|
Seems like the library you're trying to use is targeted at VC++ 7.0: a search on Usenet reveals that __ftol is an internal library of VC++ 7.0's C run-time library.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
_ftol is a function invoked when you do a double to long typecast. it's inserted automatically by the compiler:
; 38 :
; 39 : double t = 100.23;
mov DWORD PTR _t$[ebp], 1374389535 ; 51eb851fH
mov DWORD PTR _t$[ebp+4], 1079578296 ; 40590eb8H
; 40 : int l = t;
fld QWORD PTR _t$[ebp]
call __ftol
mov DWORD PTR _l$[ebp], eax
i'm not sure what _ftol2 is about, but i suspect it's a .Net thing. i see it when i accidentally try to mix VC6 and VC7 .obj files.
-c
Get there first with something patented, proprietary, and broken, then send lawyers after anyone who points out problems. --- Peter Gutmann
|
|
|
|
|
Any idea how to get around it without using VC++ 7.0 ?
The problem is I have a .lib file that references it, and i don't have the source. It's from MS
I've tried to define the function __ftol
long __ftol2(float x) {
return (long)x;
}
But i still get the link problem, i think i'm putting it in the wrong place? put i should be able to have it in any .cpp file of the project?
Jared Allen.
www.chironexsoftware.com
|
|
|
|
|
sorry , i don't know. i always fix it with a rebuild-all, but since i'm not using any libs that i don't have the source to, there's no problem once everything is rebuilt with the same compiler.
-c
Get there first with something patented, proprietary, and broken, then send lawyers after anyone who points out problems. --- Peter Gutmann
|
|
|
|
|
My last attempt at launching a fortran dll with
createThread resulted in the following error.
error LNK2001: unresolved external symbol "unsigned long
__stdcall FTREND3(void *)" (?FTREND3@@YGKPAX@Z)
Debug/cinterface3.exe : fatal error LNK1120: 1 unresolved
externals
I am not sure if the extern and DWORD prototypes are
correct? If I comment out the DWORD function prototype it
compiles and links but does not start the integer function.
Does the createThread actually pass the integer argument of 1 or just start the function and then it sees the shared memory?
Can someone comment? Thanks.
Code below:
#include <stdio.h>
#include <string.h>
#include <windows.h>
struct io {
char time[10];
int start;
};
struct io cio;
/* prototype for function */
DWORD WINAPI FTREND3(LPVOID);
//DWORD WINAPI FTREND3(LPVOID pvoid);
//extern "C" long _stdcall FTREND3 ( long );
// declspec(dllimport) for DLL's
extern "C" __declspec(dllimport) long _stdcall FTREND3 (
long );
void main (void)
{
DWORD tid;
HANDLE hThread;
cio.start = 1;
hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)
FTREND3, &cio, 0, &tid);
CloseHandle(hThread);
printf("In c after fortran thread started\n\n");
printf("string = %s\n",cio.time);
}
INTEGER FUNCTION FTREND3 (TIO)
USE DFPORT
IMPLICIT NONE
!DEC$ ATTRIBUTES DLLEXPORT :: FTREND3
TYPE IO
INTEGER START ! if 1 start timer
CHARACTER*10 timeIs
END TYPE IO
TYPE(io):: tio
DO WHILE ( tio%START .EQ. 1)
tio%timeIs = CLOCK ( ) ! Uses DFPORT
tio%timeIs = tio%timeIs // char(0)
write (6,*) 'In fortran after time call'
write (6,*) ' Time = ', tio%timeIs
FTREND3 = 1
ENDDO
FTREND3 = 0
RETURN
END FUNCTION FTREND3
|
|
|
|
|
DWORD WINAPI FTREND3(LPVOID);
extern "C" __declspec(dllimport) long _stdcall FTREND3 ( long ); These two lines shouldn't coexist. Both are function prototypes. Remove the first.
As for the second problem, main is exiting right after the thread has been launched, i.e. it without waiting for it to complete. Try replacing
CloseHandle(hThread); for
CloseHandle(hThread);
WaitForSingleObect(hThread,INFIINTE); Last point is not a question of yours but of mine What do you want to create a thread to call FTREND3 ? You sure you cannot simply call it as a regular C function?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks Joaquin,
What is the include file for the 2nd suggestion. I get undeclared for identifiers upin compile with it.
The fortran function is going to be reading alot of data continously and then reducing the data with some large fortran routines already existing. From there it will pass through the C file to a Java GUI for display. There will be option to change the read rate and other calculations that I thought would make this possible with multi threading.
The alternative was to have a thread in the Java GUI continuosly looping and calling the fortran through c wrapper but I thought there were possible time delay issues there.
Let me know if you have any thoughts on this?
Thanks for the help.
Ken
|
|
|
|
|
Hi everybody.
I'm writing a CD PLAYER, (with my own class), using the MCI COMMANDS
with the SendString function.
Everything goes well, but I have two problems.
First: How can I detect when an AudioCD is insert?.
Right now, I have a member function in my class called IsCDInsert()
and with a WM_TIMER message in my dialog, (the method wake up every second),
I can do that, but I think that this is not the right way.
Maybe the question could it be: How can I make my cd player the default player?.
Second: I have, (for example), a slider control in my dialog, and I like to control
the CD Volume with it. How can I link that control with the sistem volume function?.
I have see the MCIWndGetVolume() function, but I dont have a MCI window, and the
function waveOutSetVolume() but I think that it's only for wave files.
Well, thank you very much.
Sorry about my english.
Demian
|
|
|
|
|
"First: How can I detect when an AudioCD is insert?"
Call API function GetVolumeInformation(...). If after call succeeds lpVolumeNameBuffer variable is "Audio CD", CD is insert.
You can read description of this function here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/getvolumeinformation.asp
If you need to know if CD-ROM is present and how many CD-ROMs, call GetDriveType(...) (in case of CD-ROM it returns DRIVE_CDROM).
Sincerely, WiB
|
|
|
|
|
Thank you very much WiB.
Regards from Argentina.
Demian.
|
|
|
|
|
We have an application that is basically just a three-line loop... one is a 1-second sleep, the other two check to see if a process is running and start it if it isn't. We've noticed a lot of page faults in this application. I'm guessing its because the code is being paged out during the sleep, then paged back in when it starts up again. Can anyone suggest how to prevent this?
|
|
|
|
|
Use VirtualLock on the function address. It works only on NT and requires high priveles - usually administrator/system account.
If you only need to see if process died, you can wait on the process handle.
|
|
|
|
|
Hi all,
I'm using a CHtmlView in my app which displays a web page containing an embedded mpg video.
Is there anyway to control which plugin IE uses to play the movie?
(Ideally only for my app, rather than changing the users system wide settings)
The reason I need to do this is because I want the video to be played in a forward then backwards loop (so called ping-pong or palindrome mode). It seems that this functionality is only provided by QuickTime not the inbuilt media player or real player for example.
I plan to install QuickTime at the same time as my app, but I am worried if the user installs another playback plug-in afterwards it will break the playback of my video in my app.
Any suggestions to control the mime types or is there a way to choose the plugin in the html itself?
--
The Obliterator
|
|
|
|
|
Hello,
I need to use template functions, but as it seems that they must be declared and defined in the same file, I've placed them in the header file.
After doing this I've noticed two problems:
1. I can't use breakpoints there.
2. I can't see the functions in the class wizard.
Any advice? mostly on the first topic, I can live with the second one... but I need to be sure that the pointers passed as parameters are the right ones and I need to be able to debug that functions...
Thank you in advance.
|
|
|
|
|
Having just knocked up a quick test application, I have no problem with setting the breakpoints in the header file.
I would guess that maybe the debug information is incorrect for your project (I presume you've tried a full rebuild?) or you have some strange compiler settings that are causing problems, but beyond that I don't see any reason why you can't set breakpoints.
Sorry I can't assist you any further than that.
--
Ian Darling
|
|
|
|
|
The functions are template based declared in this way:
template<class T> inline long WriteSomeData(CString csNameOfTheVar, T TemplateParam, int iPort)
{
...
} this declaration is placed as a member of one class.
then, I can't place a breakpoint and make it work right.
Any idea?
|
|
|
|
|
Nothing looks amiss to me. My first reaction told me it was the inline, but I seriously doubt that's the problem (although I do doubt the usefulness of that inline in this context
--
Ian Darling
|
|
|
|
|
Hello,
Ian Darling wrote:
I do doubt the usefulness of that inline in this context
Why do you doubt that?
I use that function from some others a lot of times and if I have not misunderstood the inline modifier, it's purpose is to give more velocity to the program by not calling the inline function but adding the inline function code at the place where the inline function call is.
Then the pourpose it's clear, isn't it?
|
|
|
|
|
If you include the body of a function inside the class definition, then it is the same as if you qualify it with inline . That is,
class A
{
int f(){cout<<1<<;}
}; is equivalent to
class A
{
inline int f();
};
...
int A::f()
{
cout<<1;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello,
First of all thank you for your answer, it has explained me other thing that I didn't know, but after removing the inline , it makes the more or less the same:
1. I can't debug the function properly (some times I can debug it (the compiler stops at the breakpoint) and sometimes not and the function is being called (I'm sure about that last part)).
2. The functions involved (there are various functions placed in the header file) continue without appearing in the ClassView...
Could you tell me what's happening?
As always, thank you in advance...
|
|
|
|
|
1. I think this is a problem with the debugger and template member functions (I've experienced similar strange things in the past). One way (not tested myself) to make sure the debugger always stops is as follows:
template<typename T> void CMyClass::Whatever()
{
DebuggerStopper();
...
}
void CMyClass::DebuggerStopper()
{
} 2. The class viewer is crap, I don't know any fix for that.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Well, thank you, I've tested it and it worked OK, I'll be able to detect errors in those functions now.
Talking about the other thing... I think I'll be able to live with it... moreover when I'll place that code inside a DLL for further use of it.
as always, thank you very much.
|
|
|
|