|
Hi,
I have a specific problem:
I need to draw a text like "HomeSweet Home" but it should wordwrap and after wrapping It should be displayed as
"HomeSweet
Home"
how can I do that?
|
|
|
|
|
You may use the DT_WORDBREAK format flag (or manually insert a carriage return-linefeed sequence), see DrawText at MSDN[^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi I am trying to create a TCP/IP port programatically in win32.
Here is my code.
HANDLE hXcv;
PRINTER_DEFAULTS pd = {NULL, NULL, SERVER_ACCESS_ADMINISTER};
TCHAR szBuf[MAX_PATH] ={0};
TCHAR szMsg[512];
DWORD dwLastError;
::lstrcpy(szBuf, TEXT(",XcvMonitor Standard TCP/IP Port"));
if(OpenPrinter(szBuf, &hXcv, &pd) != FALSE )
{
OutputDebugString(TEXT("Hello. It worked....!"));
}
else
{
dwLastError = GetLastError();
wsprintf(szMsg, TEXT("OpenPrinter return error:%d\n"), dwLastError);
OutputDebugString(szMsg);
}
> But the problem is OpenPrinter API failing and returning
error code as 5 (ERROR_ACCESS_DENIED).
> But when I try to create the port manually (print properties), port is created.
> I have logged in as an administrator and I have all permissions.
I am working on Windows Server 2008 R2 Statndard (64 bit OS)
Note: OpenPrinter API working fine if I turn-OFF User Account Settings (UAC). Failing if UAC is ON
Please tell me what's wrong with my code.
Thank you in advance.
Regards
msr
modified on Monday, February 14, 2011 6:29 AM
|
|
|
|
|
There is nothing wrong in your code and also do not turn off UAC. Try to execute you application in admin privileges.
select RequireAdminstration as a property.
For future reference:
Google this keyword "Windows7GATrainingKitForDevelopers.Setup.exe" and run this exe. Its a training kit for developer working on Windows 7. It is awesome.
I believe in LOVE AT FIRST SIGHT...
Bcoz I have loved my Mother...
even since I opened my eyes...(ICAN)
|
|
|
|
|
Hi,
"select RequireAdminstration as a property"
I have not understood the above statement.
Cab you just explain me how to do this?
Regards
msr
|
|
|
|
|
1) Open Project property page
Project->Property or use shortcut key (Alt + f7).
2) Select Linker->Manifest File, There is one property UAC Execution level. select this option as requireAdminstration.
When you do this than your application is self elevated and run under admin privilege.
I believe in LOVE AT FIRST SIGHT...
Bcoz I have loved my Mother...
even since I opened my eyes...(ICAN)
|
|
|
|
|
Hi, thanks for the reply.
But in vs2008 there is no such option (Linker -> Manifest fie)for vc++ win32 projects.
Regards
msr
|
|
|
|
|
No I am able to view this property on VS2008 with win32.
What are you doing ?? Please explain....
I believe in LOVE AT FIRST SIGHT...
Bcoz I have loved my Mother...
even since I opened my eyes...(ICAN)
|
|
|
|
|
But I am building a static library.
I think Linker option is not applicable.
Regards
msr
modified on Wednesday, February 16, 2011 11:15 PM
|
|
|
|
|
Hi All
I am using gluBuild2DMipmaps() for show live video buffer.
but it is using the CPU around 50%.
Please suggest how to reduce CPU usages.
Here I am sending you the source code for render.
for (int loop=0; loop<2; loop++)
{
if (loop==0)
{
m_bRenderFromVideo=FALSE;
if(m_pbVideoData)
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, m_iVideoHeight,m_iVideoWidth ,GL_LUMINANCE, GL_UNSIGNED_BYTE, m_pbVideoData);
glViewport(m_iNoOfColumn - m_iNoOfColumn * m_iSizeVideo.x, m_iNoOfRow - m_iNoOfRow * m_iSizeVideo.y,
m_iNoOfColumn * m_iSizeVideo.x, m_iNoOfRow * m_iSizeVideo.y);
glPushMatrix();
gluOrtho2D(-window_width/4, window_width/4, -window_height/4, window_height/4);
glLoadIdentity ();
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_LIGHTING);
glBegin(GL_QUADS);
glTexCoord2f(1.0f, 1.0f); glVertex3f( 21.0f, 18.3f, -10.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(-21.0f, 18.3f, -10.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f(-21.0f, -18.3f, -10.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f( 21.0f, -18.3f, -10.0f);
glEnd();
glScalef(m_fScale, m_fScale, m_fScale);
glRotated(m_fRAngle[0],0.0, 0.0,1.0);
}
else
{
glPushMatrix();
glViewport(0, 0, window_width, window_height);
glLoadIdentity();
glScalef(m_fScale, m_fScale, m_fScale);
glRotated(m_fRAngle[0],1.0, 0.0, 0.0);
glRotated(m_fRAngle[1],0.0,1.0, 0.0);
glRotated(m_fRAngle[2],0.0,0.0,1.0);
}
}
|
|
|
|
|
You have two choiches:
1) Buy a computer with a faster CPU
2) Check if the OpenGL settings on your computer are fine with your hardware (that may be OpenGL capable itself, but may be the library doesn't know it)
Seriously: there is nothing strange in your program. Simply, OGL is a bad beast!
The only thing to check is the driver of your graphic card (are they the correct ones? sometime the OS setups guess wrong settings) and relative settings (if they are), as well as the OGL settings in the control panel (if there are).
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
GAJERA wrote: but it is using the CPU around 50%.
How does your main loop looks like ? I am guessing that you have a continuous loop without any sleep and that your program runs on a double core. In that case what happens is that your loop will be executed continuously and you will probably get a very high framerate. If you can live with a lower (and fixed) framerate, you can simply execute your drawing code every x msec (choose an appropriate time interval between two frames). The rest of the time, your program should sleep (well in fact wait for user events). You can find more info in one of my articles here[^]
|
|
|
|
|
Although this is a Visual Studio specific thing, it seems this forum (based on the help info from the website) is for Visual C++ questions/issues.
Visual Studio project handling has gone so far downhill since 6.0, it's astounding.
Once again, I've been stupidly bitten by the thinking I can apply an All Config/All Target parameter (preprocessor directive in this case) forgetting that it will blow away all the other carefully crafted per Config/Target values.
This seems so stupid, I feel I must be missing something obvious? I mean, if I change something project wide like precompiled headers, it doesn't destroy the individual file settings.
Has VS v9 really lost the ability to properly handle file/config/target/global settings like preprocessor directives? Please tell me there is something obvious that I should click/check/choose in order to have a global item simply be added, rather than something so remarkably wrong as removing all the specific items and replacing them?
Sorry if this sounds like a rant, but I just lost ALL the target specific settings for all 6 projects in my solution because I had to add _CRT_SECURE_NO_WARNINGS to all targets/configs. I have them in SVN, but still, there were other changes I've made tonight that I will lose. And given how advanced VS v9 is, it seems insane that I'd need to wear out my mouse battery with all the individual clicking and pasting that doing it one at a time would take.
Thank goodness for :1,$s/(XX)/\1;YY/ in vim... But why has this gotten so very, very wrong since VS v6?
Hoping to find out I've just stupidly overlooked something,
|
|
|
|
|
Craig Longman wrote: I just lost ALL the target specific settings for all 6 projects in my solution because I had to add _CRT_SECURE_NO_WARNINGS to all targets/configs.
I don't know why this happened to you but I have got many projects with individual and independent file, config, etc settings, which I can change without problem. This has worked for me through the Visual Studio Express Editions 2005, 2008, and 2010.
BTW there is a Visual Studio specific forum.
I must get a clever new signature for 2011.
|
|
|
|
|
Even with only one project, in VS v9, if I select all targets/platforms and put in a preprocessor directive, it simply removes all the current directives and replaces it with what I typed in. This doesn't happen this way for you?
Sorry about the wrong forum, I looked, but the closest I saw was this one having a description of "C, Visual C++ and MFC" and thought it was the closest.
|
|
|
|
|
Craig Longman wrote: it simply removes all the current directives and replaces it with what I typed in.
I just tried that in Visual C++ Express 2010 and it works fine, the new value gets added but nothing gets deleted.
Craig Longman wrote: I looked, but the closest I saw was this one having a description of "C, Visual C++
Hmmm, I would have thought that "Visual Studio" is closest; this question has almost nothing to do with C, C++ or MFC.
I must get a clever new signature for 2011.
|
|
|
|
|
I just did it again in v9 and when All Configurations is selected, it replaces them all. I guess it was fixed.
Richard MacCutchan wrote: Hmmm, I would have thought that "Visual Studio" is closest; this question has almost nothing to do with C, C++ or MFC.
Indeed, I guess I didn't actually point out that the Visual Studio way at the bottom escaped my attention. =)
Thanks anyway, clearly something resolved in the next version, another good reason to upgrade I guess. Just gotta be careful for the time being.
|
|
|
|
|
It's not just you. What's crazy is if you copy preprocessor settings from another project and paste them, it's smart enough to remove duplicates!
|
|
|
|
|
Hi there i am currently facing this problem. I use forward declaration to declare both structs but when doing an assignment to the struct it complains that is undefined.Ex. i have this structs:
struct A;
struct B;
struct A
{
int lolipops;
B* candy;
A(B* ptr)
{
lolipops = 0;
candy = ptr;
}
action(int pass)
{
candy->gums = pass;
}
};
struct B{
int gums;
A* candy;
B(A* ptr)
{
gums = 0;
candy = ptr;
}
action(int pass)
{
candy->lolipops = pass;
}
};
This is a sample not used currently by me but it ilustrates the problem. Can someone tell me what is wrong?
modified on Sunday, February 13, 2011 4:54 PM
|
|
|
|
|
Sorry, my original answer does not work. Something strange about this post, the forward declarations did not show in the posted question.
Please also use <pre></pre> tags round your code - set by the code block button.
The forward declaration will only help you to have pointers to B types in structure A . You will not be able to refer to any of the variables or methods of B as they have not been defined at that point. You will need to modify your design to resolve your problem.
I must get a clever new signature for 2011.
modified on Sunday, February 13, 2011 4:49 PM
|
|
|
|
|
Can you tell me how to solve it. What it needs to be modified?, Please
|
|
|
|
|
There is no fix for what you want, since you have effectively got circular dependencies: A refers to B and B refers to A so one of them will be undeclared in the declaration of the other. You cannot make this work and need to redesign your program to remove such dependencies.
I must get a clever new signature for 2011.
|
|
|
|
|
Not sure it suffices, however within the structs, I would use struct B* instead of just B* , and likewise for A* .
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Nope i tried your suggestion and doesn't work either
|
|
|
|
|
you replaced all of them? it should never throw two errors, when the compiler reaches the second struct it knows all there is to know about the first one.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|