|
When dealing with OpenGL, GPU is often more important than CPU
Following the video card, the framerate may vary considerably (i've still experienced a variation from 1.5 fps to 50 fps !)
I hurt so bad inside
I wish you could see the world through my eyes
It stays the same
I just wanna laugh again
|
|
|
|
|
Hi,
I need to draw some text rotated 90º in the screen, for that, what I did is to transform the normal font, and call ExTextOut...
...But I have a problem, with multiline text... with DrawString was now problem give a rect and make the text fit there... but it seems that DrawString doesn't work for rotated text, and does ExTextout support this ?
Thanks in advance, Greetings
Braulio
|
|
|
|
|
Try here[^].
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
I have a CFormView class and I'd like to automatically resize the window when the user turns off the toolbar or status bar. In other words, I don't want the blank area of the form view (usually hidden by the toolbar or status bar) to show up when the user toggles the status of either bar.
I haven't seen any source that does this, so any help would greatly be appreciated.
Thanks!
Jonah Bishop
Visit JGB Productions
http://www4.ncsu.edu/~jgbishop
|
|
|
|
|
Use SetWindowPos()
i.e.:
WINDOWPLACEMENT wp;
GetWindowPlacement(&wp);
wp.rcNormalPosition.left = rectNewRect.left ;
wp.rcNormalPosition.right = rectNewRect.right ;
wp.rcNormalPosition.bottom = rectNewRect.bottom ;
wp.rcNormalPosition.top = rectNewRect.top ;
wp.showCmd = SW_SHOWNORMAL;
SetWindowPlacement(&wp);
or something similar...
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
I see how I would use that, but how do I figure out the new window size when hiding or (more importantly) showing the toolbar or status bar? Is there a call to get the view size (with the toolbar) and also get just the toolbar size (to subtract or add to the view size)?
Thanks!
Jonah Bishop
Visit JGB Productions
http://www4.ncsu.edu/~jgbishop
|
|
|
|
|
int x_size = GetSystemMetrics(SM_CXSCREEN);
int y_size = GetSystemMetrics(SM_CYSCREEN);
int x_max = GetSystemMetrics(SM_CXMAXIMIZED);
int y_max = GetSystemMetrics(SM_CYMAXIMIZED);
int yToolbar = y_size - y_max;
I think...
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Oops. I should have checked a little more thoroughly here at the site...
I found the exact thing I was looking for in this article.
But thanks for your prompt replies, Nitron. They are certainly appreciated!
Jonah Bishop
Visit JGB Productions
http://www4.ncsu.edu/~jgbishop
|
|
|
|
|
I had in a C dll, that was called by VC++, the following and it worked fine:
#define DllExport __declspec( dllexport )
DllExport void __cdecl Fusion_Method(int *nalg, int *score, int *fusion_score)
{
I wanted to call this dll in a VB program and am told I need to do _stdcall. I searched the web but dont see how to modify the above to make it stdcall instead of __cdecl. Please help!
Appreciate your help,
ns
|
|
|
|
|
Just replace __cdecl with __stdcall in the declaration of FusionMethod . That's all you need to do (hopefully).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Good try. It compiled fine. But the VB callling program stubbornly still says it doesnt know anything about the function from the dll.....
Thanks so much for helping though...
Appreciate your help,
ns
|
|
|
|
|
Am I doing this right?
#define DllExport __stdcall( dllexport )
//#define DllExport __cdecl( dllexport )
//DllExport void __cdecl Fusion_Method(int *nalg, int *score, int *fusion_score)
DllExport void __stdcall Fusion_Method(int *nalg, int *score, int *fusion_score)
This wont even compile!
Thanks though, for the input
Appreciate your help,
ns
|
|
|
|
|
Try this:
#define DllExport __declspec( dllexport )
extern "C" DllExport void __stdcall Fusion_Method(int *nalg, int *score, int *fusion_score)
...
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Compiler says:
c:\pmarmodif\fusionmethod.c(3) : error C2059: syntax error : 'string'<br /> pointing at the extern line.....
Thanks for keeping up with my issue here...
Appreciate your help,
ns
|
|
|
|
|
Ummm.. I guess fusionmethod is C++ code, so change the extension to .cpp . The fact that you're declaring the function as extern "C" does not have to do with the language you use to implement it.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
The others who respond are correct, I'm only adding on here. One thing I've found when I want to use __stdcall is the need to include a line defining the function in the .def file for the project.
So if your dll project is named "ABC", open "ABC.def", and add the following line to the "EXPORTS" section (it must be on it's own line):
Fusion_Method
Now, build your dll again, and the function should be exported with the correct name.
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
Thank you to all who helped. Chris - I did indeed go the .def file route and have it working though its churning out an incorrect result. However it recognises the exported function now. One question though: Dont I need to specify the arguments of Fusion_Method in the def file? Like Fusion_Method( int*a, int* b, int*c) ?
Thanks
Appreciate your help,
ns
|
|
|
|
|
You don't need to specify the arguments in the .def file. When you say "incorrect result" what do you mean? Keep in mind, that you need to take Joaquín's comments into account (by using __stdcall instead of __cdecl).
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
I had a slight error in the calling VB program which was making the numerical result incorrect. Once I removed the argument list from the def file and fixed the VB problem, it worked fine.
My next task is to find a compiler for this user who wants to be able to compile the Dll but refuses to install V Studio. SO far the gcc compiler I've looked into (I'm on windows) doesnt tell me how to compile a dll given a .c and a .def file.
Anyways, the coding problem has been resolved, so I thank you for your input.
Appreciate your help,
ns
|
|
|
|
|
Hi,
I have a small question regarding pointers.
I have an 2D array of ints like:
static int ERBaCoeff_22050[2][7] = {
{1, 2, 3, 4, 5},
{6, 7, 8, 9, 10}};
I try to do something like this:
int ** a = ERBaCoeff_22050;
The compiler throws an error. Saying cannot convert a int[2][7] to a int**
I thought this was a legal assignment. I even tried something like:
int ** a = &ERBaCoeff_22050;
but no luck.
Also,
int * some = &ERBaCoeff_22050[0][0];
int ** a = &some
This works. But I cannot traverse the array beyond the forst row...
i.e. a call to a[1][1] fails, but a [0][7] works
It works when I do:
char *ptr;
char arrayChars[8] = {'F','r','i','e','n','d','s','\0'};
ptr = arrayChars;
What am I doing wrong??
I would greatly appreciate any help you guys can give me.
Thanks,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
A couple of things strike me.
1. In your first declaration
int **a=ERBaCoeff_22050
You are trying to set a pointer to a pointer to an array. This wont work as the array is not a pointer.
That is why
pankajdaga wrote:
int * some = &ERBaCoeff_22050[0][0];
int ** a = &some
works. You are first setting an int pointer to point to the array then setting the a pointer to point to the pointer. This is the only way you can do it.
2. You cant address the second row because the compiler doesnt know how big the rows are in the array. while a[0][n] always refers to the first row a[x][y] refers to row x and requires the compiler to do the math to find the correct row, it cant do this if it doesnt know the size of the rows.
Look at it like this an int* is a row of int with as many as you like so a[10] and a[0][10] are the same thing all the way to a[0][infinte] but given that the row is infinte in length what does a[1][1] actually mean.
I think this explination is correct. Someone correct me if im wrong
I hope this helps.
|
|
|
|
|
Hi,
Thanks for the explanation. Helps a lot
However, my problem is what is the best way to traverse such an array. I need to pass it to another function and I do not want to make a copy of the array. I want to pass a reference and access the elements. I am still trying to figure out the best way to do so.
Thanks,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
Have a lookie at this[^].
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Hi,
Yeah, I figured out the declaring part. I am having trouble traversing it in a function when it is passed as an argument to it.
Thanks,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
It doesn't really seem like you need a pointer to a pointer. I would use a simple wrapper class for a 2d vector and use that. Here's a demo console app showing what I mean:
#include "stdafx.h"
#include <vector>
class InnerArray
{
public:
std::vector<int> y_value;
};
class CMyArray
{
public:
CMyArray(const int& x_size, const int& y_size)
{
nx = x_size;
ny = y_size;
for(int x = 0; x<x_size; x++)
{
x_value.push_back(new InnerArray);
for(int y=0; y<y_size; y++)
{
x_value[x]->y_value.push_back(0);
}
}
};
int GetData(const int& x_, const int& y_) const
{
return x_value[x_]->y_value[y_];
};
void SetData(const int& x_, const int& y_, int data)
{
x_value[x_]->y_value[y_] = data;
};
virtual ~CMyArray()
{
x_value.clear();
};
private:
int nx;
int ny;
std::vector<InnerArray*> x_value;
};
void MyFunc(CMyArray cma);
int main(int argc, char* argv[])
{
int x=0;
int y=0;
CMyArray ERBaCoeff_22050(2,7);
for(x=0; x<2; x++)
{
for(y=0; y<7; y++)
{
ERBaCoeff_22050.SetData(x,y,((x+1)*(y+1)));
}
}
MyFunc(ERBaCoeff_22050);
return 0;
}
void MyFunc(CMyArray cma)
{
printf("\n\n");
for(int x=0; x<2; x++)
{
for(int y=0; y<7; y++)
printf("\nValue Of ERBaCoeff_22050[%d][%d] = %d", x,y,cma.GetData(x, y));
}
printf("\n\n");
}
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|