|
Hi
All
I want to read value in string table in resource dll in VC++ 6.0. I want to call value in string table in Dll to another application. If anybody have solution to this plz send me.
Thanks in advance.
Atool
|
|
|
|
|
M. Atul wrote: I want to read value in string table in resource dll in VC++ 6.0. I want to call value in string table in Dll to another application.
Use LoadLibrary and LoadString.
M. Atul wrote: If anybody have solution to this plz send me.
Read this[^] too. Point number 2.
|
|
|
|
|
Hi All!
When in a simple project, I add a control activeX in a dialogue box it work perfectly, however when i make the dialog box (containing the activeX) in a dll (MFC DLL), i get nothing (no dialog box and consequently no activeX). When i remove the activeX control, the dialog box can be displayed!
my question is so how to add a activex control in a dll?
Thank u in advance.
Nirmal
|
|
|
|
|
I think the problem lies with the resource file being used.. As the dialogue template is in your DLL, where as your main app searches the template in its own resources and consequently dont find anything .. Try using the dll's resources .. try using the FindResource(..) function and then creating the dialogue from the template returned by the function .. I hope it helps enjoy.
|
|
|
|
|
I would ask this question on the algorithms/maths board, but I feel it is more appropriate here.
Lets say I have 2 points, { X1,Y1 } and { X2,Y2 }, I want to calculate the rotation of #2 around #1 given a number of degrees. What is the fasted possible way to do this in C++?
Here is my method, which I find to be too slow.
X2 = X1 * cosf(rotate) - Y1 * sinf(rotate);<br />
Y2 = X1 * sinf(rotate) + Y1 * cosf(rotate);
|
|
|
|
|
You code calculates cosf() and sinf() twice - you could probably speed things up by almost 2 x by only calculating cosf(rotate) and sinf(rotate) once and assigning the values to local variables.
Hope this helps
Tony
|
|
|
|
|
As calculating cosines and sines is expensive, another optimization could be to just calculate them once and make a table for the values ( may in application startup ) this will considerably increase the speed . If you are rotating these values multiple times. A question you might ask is but the value for the angle could be infinte and hence the table size. The catch here is every angle's cosine/sine is equal to an angle b/w 0-180 (0-pie).. so pratically you need only a table of 180 entries .
I hope this help!
enjoy
|
|
|
|
|
Thats an excellent idea, thanks for that.
|
|
|
|
|
The pleasure is all mine :->
|
|
|
|
|
Nutkase is right, this method can dramatically improve performance but is only suitable if you can live with integer angle values (every degree) since these will be used directly as indexes into the look-up tables.
If you need finer resolution than 1 degree you could consider having table entries every 0.1 degree but you would need to scale the angles to ensure that you have integral values e.g. 15. degrees would be index 15 in the table.
Naturally the tables would be 10 times bigger i.e. 1800 entries (actually you could get a way with storing values for only 90 degrees
|
|
|
|
|
softwaremonkey wrote: only suitable if you can live with integer angle values (every degree)
Thats no problem in this instance.
The major problem I am having at the moment is when placing the rotation code inside a loop, where the point being rotated is constantly being refreshed.
Here is a slightly faster method I have tried to adapt.
FPOINT Rotate( float px, float py, float ox, float oy, int a )
{
float s = ( PI * a ) / 180;
FPOINT q = { px, py };
if ( px == ox && py == oy ) {
return q;
}
float r;
if ( px == ox ) {
if ( py > oy ) {
r = PI / 2;
} else {
r = - PI / 2;
}
} else {
if ( py == oy ) {
if ( px < ox ) {
r = PI;
} else {
r = 0;
}
} else {
if ( px < ox ) {
r = atan( (float)( py - oy ) / ( px - ox ) ) + PI;
} else {
r = atan( (float)( py - oy ) / ( px - ox ) );
}
}
}
float hyp = sqrt( (float)( (px - ox) * (px - ox) ) + ( ( py - oy ) * ( py - oy ) ) );
q.x = ( ox + cos(s+r) * hyp );
q.y = ( oy + sin(s+r) * hyp );
return q;
}
It's faster, but doesn't work correctly. I have 4 points denoted by the corners of a rectangle. I calc the center of the mass and pass it is as point 'o', then for each of the 4 points 'p' A calc their new positions. The resulting rectangle appears to rotate about the top-right corner ( which itself is traveling up and down a 45 degree line ). I can't for the life of me see where it is going wrong.
|
|
|
|
|
NM...
It was a stupid error in calculating the center of the mass.
|
|
|
|
|
hi,
what is the need for advapi32.lib??
|
|
|
|
|
mike dano wrote: what is the need for advapi32.lib??
For dynamically linking to advapi32.dll which contains registry related functions, service related operations and many more.
Just use dependency walker to find out what are the functions being exported by advapi32.dll
|
|
|
|
|
Hi,
I have some code that tries to get hold of a mutex using WaitForSingleObject and if it succeeds, it performs a sequence involving a delay using Sleep(). My question is, will the thread still own the mutex while it is sleeping or can other threads get hold of it? I DONT want other threads to be able to grab the mutex during the delay. The code is something like...
{
if(WaitForSingleObject(m_hDcpdMutex, DCPD_TIMEOUT) != WAIT_OBJECT_0)
{
return false;
}
m_pKeithley->ReadChannel(m_nCrackPDChan[i], &pOffVals[i]);
SetCurrent(1); // Turn current on
Sleep(m_nSettleTime); // Allow to settle
m_pKeithley->ReadChannel(m_nCrackPDChan[i], &pOnVals[i]);
SetCurrent(0); // Turn current off
ReleaseMutex(m_hDcpdMutex);
return true;
}
Any help/comments would be much appreciated!
Tony
|
|
|
|
|
softwaremonkey wrote: My question is, will the thread still own the mutex while it is sleeping or can other threads get hold of it? I DONT want other threads to be able to grab the mutex during the delay. The code is something like...
From the docs:
Only one thread can own a mutex at any given time. <code>The owning thread uses the
ReleaseMutex function to release its ownership.</code>
|
|
|
|
|
Hi,
I am trying to use some open source codes which is trying to include the <hash_map> header and it's not found in VC6. May I know if it is possible for me to download the missing header and source somewhere and use it in my project?
I saw a website as below:
http://www.cs.cmu.edu/afs/cs.cmu.edu/user/gchen/www/download/stl/download.html[^]
How can I use it? Thanks.
-- modified at 4:27 Monday 22nd January, 2007
|
|
|
|
|
whatever@whatever.com wrote: which is trying to include the header
Which header ?? We can hardly help if you don't provide at least minimum information about your problem.
whatever@whatever.com wrote: May I know if it is possible for me to download the missing header and source somewhere and use it in my project?
Probably not because if you don't have the header file, you probably don't have the necessary library neither.
|
|
|
|
|
Sorry. its using the hash_map> container. any idea if i can download the library and include it in my project? Thanks.
|
|
|
|
|
hash_map is not part of the STL. Perhaps you can get it from boost, or something ?
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hai to all..
i'm now started working in the field fo VC++..
Can any plzz tell me how to convert doc files to pdf files...
is there any example codes availble for doing this process...
plzz help me...
senthil
|
|
|
|
|
As far as i remember Office 2007 provides this functionality built in .. export the doc to pdf. You can use the automation object for Winword to achieve this if they export the functionality. I havent worked on it but just to give you direction
|
|
|
|
|
wrote: Can any plzz tell me how to convert doc files to pdf files...
One way is to install Install Adobe Acrobat.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hai David and nutkase,
thanks for ur reply...
i already installed Adobe Acrobat...
What i want to know is....
How do i programatically convert doc files to pdf files....
is there any example codes availble in the net...
Can u plzz give me an idea for doing this process...
thanks...
senthil.
-- modified at 0:00 Tuesday 23rd January, 2007
|
|
|
|
|
I am a novice in Visual C++ programming. I have to create an application which acts as the front end for accessing records in a database.
Should I go in for an SDI application or a dialog based one?
There should also be the facility that new pages/dialogs should open on clicking of command buttons like "save", "Login", etc and every such new page should have database acces for entering and deleting records.
Is this possible using SDI application? What should be the base classes of the subsequent dialog boxes that I create? I tried inserting a new dialog by selecting IDD_FORMVIEW in the drop down list for insering new dialogs and having the base class as Crecordset. But i am not able to open this second page on clicking a command button in the first page. Can someone please give me a step by step procedure on how to accomplish this?
Or should i go in for a dialog-based application? Again, what should the base classes be of subsequent dialogs?
Thanks
|
|
|
|