|
Hm, just pasted the code to another location and there it compiles fine.
I originally had it at the location where the original definitions are, that produced the error. This leads me to believe that it's not this code, it is something in the headers or code that comes before.
Thanks for giving me the idea to test this, hadn't thought of checking headers.
P.S.:
The line you quoted is a definition, not just a declaration. I am not aware there is any need for a ';'?
|
|
|
|
|
in general, compiler messages and run-time exceptions provide filename, classname, linenumber information to avoid any confusion. use them to your advantage.
|
|
|
|
|
I am assuming this is meant to be helpful, but it is not. The compiler did not give me any more information than what I offered in the OP, and it did point to what in my obfuscated example is represented by the function sum().
There's nothing wrong I see whith that function, nor with the object that is being instantiated there, and still, the fact that this object is there and the class is being defined as it is somehow contributes to the compiler generating a warning.
I wouldn't be surprised if I eventually find the MS libraries to responsible - I just worked on another problem and after about a half hour of searching I eventually realized it was due to a global #define in winsock.h. Thank you MS!
|
|
|
|
|
When I use VS2010 for native C, I get messages such as
...nativecode.c(13) : warning C4700: uninitialized local variable 'k' used
which clearly points to line 13.
What compiler are you using that doesn't do so?
|
|
|
|
|
I've found the culprit. It's the external library declarations. Apparently all or most of them contain lines like this:
# ifdef NT
# ifdef _DEBUG
# pragma comment( lib, "geomkern70d.lib")
# else
# pragma comment( lib, "geomkern70.lib")
# endif
# pragma optimize("", off)
# endif
Note the #pragma optimize line, that is executed independent of whether or not this is debug code (i. e. it's outside the #ifdef _DEBUG block)! This will affect every file that directly or indirectly references this external library! (or any other external library with similar DECL headers)
Obviously, this line overrides the project settings, and thus code does not get optimized, no matter what I say
I will now go and investigate why this line is in there, and whether or not it's safe to remove it. Provided I can still find anyone who was around at the time this code was written...
P.S.: the reason I posted the whole context was that I found a whole bunch of *decl* header files looked exactly like that, so I at first assumed it was generated, either by VS 2003, or whatever IDE was being used at the time these were created. I am still not sure about that...
modified on Friday, September 24, 2010 7:02 AM
|
|
|
|
|
Hi!
I've two arrays. One array of strings. Another one of StaticText boxes. I've to read the array from the end and set each string to the StaticText element starting from the beginning(i.e I've to set the last text to the first static text element). Can anyone help me how to traverse these two arrays?
|
|
|
|
|
Traverse array with static boxes from top to bottom and use another variable to get the values from the second array.
Ex: NO_OF_ELEMENTS is the number of elements you have in the arrays and number should be the same for both the arrays
<br />
for (i=0;i < NO_OF_ELEMENTS;i++)<br />
{<br />
}<br />
I am a HUMAN. I have that keyword (??? too much) in my name........
_AnsHUMAN_b>
|
|
|
|
|
In different format, but sometimes preferable (although it is a matter of taste)
for(int i=0, j=N-1; i<N; ++i,--j)
a[i].operation_on(b[j]);
use two indexes, but does not recalculate the offsets.
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
for (i=0;i < NO_OF_ELEMENTS;i++)
{
m_stArray[NO_OF_ELEMENTS-i -1 ].SetWindowText (m_strArray[i]);
}
|
|
|
|
|
make the IDs of the boxes in order or fetch their handles in an array...
it works fine
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hello All,
I want to delete "Games" from windows 7. i.e. delete all the installation files from the system, so that if in case user turns the Game feature ON, OS should ask for some media like DVD to copy those installation files.
Turn the Feature OFF & ON does not achieve my target. i have to remove files to make more space available.
NOTE: By default windows 7 contains all the files within its local storage ie HDD
Any suggestion how to approach the problem.
Thanks!
modified on Thursday, September 23, 2010 5:26 AM
|
|
|
|
|
With C/C++ ? or is this a general question ?
Watched code never compiles.
|
|
|
|
|
it is general discussion. or if there is any API or any way in C, i can go for that too.
|
|
|
|
|
I have create a SDI application with Doc/View architecture. I have attached a view while creating mainframe (code below).
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(COptiumDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CMyView));
I want to access function created in CMyView from the Mainframe.
How can I do that?
|
|
|
|
|
CMyView* pView = (CMyView*)GetActiveView()
for further problem to have pointer access look here ^
modified on Friday, September 24, 2010 1:14 AM
|
|
|
|
|
hi
I want to draw a perpendicular line from another line.How can it be implemented in VC++(GDI).
thanks
|
|
|
|
|
Have you looked at MoveTo() , LineTo() , et al?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Use analytic geometry this is easy to solve. A line can be defined by two points. You want another line that passes through a point and form a right angle with the first line.
After you find the second line use GDI functions MoveTo() and LineTo() to draw the second line.
|
|
|
|
|
Hi,
I have created a CListControl, I want to draw grey border color around it so I write the below code to draw border but all string are not visible.
How to do that?
void CListCtrl::OnPaint()
{
CPaintDC dc(this);
CRect rect;
GetClientRect(rect);
CPen pen(PS_SOLID,1,RGB(211,211,211));
CBrush* pOldBrush = (CBrush*)dc.SelectStockObject( NULL_BRUSH );
dc.SelectObject(&pen);
dc.Rectangle(&rect);
pOldBrush->DeleteObject();
pen.DeleteObject();
}
|
|
|
|
|
You need to override the OnNcPaint, not the OnPaint.
And don't forget to call "Default();" to draw the interior
for example (done for a listbox derived class, but you should be able to see how it workd...
void MyListBox::OnNcPaint()
{
// draw the inside.
Default();
// draw over the border.
CRect rc;
GetWindowRect(rc);
CDC *pDC = GetParent()->GetDC();
GetParent()->ScreenToClient( rc );
// do the drawing ...
pDC->FrameRect( rc , brush );
rc.DeflateRect( 1, 1, 1, 1 );
pDC->FrameRect( rc,brush );
}
Watched code never compiles.
|
|
|
|
|
Thanks for you reply.
I replied (code below) but getting any border around the window
void CTxListCtrl::OnNcPaint()
{
Default();
CRect rc;
GetWindowRect(rc);
CDC *pDC = GetParent()->GetDC();
GetParent()->ScreenToClient( rc );
CBrush brush(RGB(255,0,0));
CPen pen(PS_SOLID,1,RGB(211,211,211));
pDC->SelectObject(&pen);
pDC->Rectangle(&rc);
pDC->FrameRect( rc , &brush );
rc.DeflateRect( 1, 1, 1, 1 );
pDC->FrameRect( rc,&brush );
}
|
|
|
|
|
Why not set a style that creates a client edge around your CListCtrl:
BEGIN_MESSAGE_MAP(CMyListCtrl, CListCtrl)
ON_WM_CREATE()
END_MESSAGE_MAP()
void CMyListCtrl::OnCreateStyles()
{
ModifyStyle(WS_BORDER, 0);
ModifyStyleEx(WS_EX_STATICEDGE, WS_EX_CLIENTEDGE);
}
void CMyListCtrl::PreSubclassWindow()
{
CListCtrl::PreSubclassWindow();
OnCreateStyles();
}
int CMyListCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CListCtrl::OnCreate(lpCreateStruct) == -1)
return -1;
OnCreateStyles();
return 0;
}
|
|
|
|
|
This is adding HSCROLL and VSCROLL also. I dont need scroll bar.
Plz give a light on this issue.
|
|
|
|
|
Hi, I wrote two C++ Windows applications which I previously used on WinXP.
The main MFC application gets no UAC prompt when I start it, works fine on Win7.
The Win32 application, which is just a WinMain() with some functionality, gets an UAC prompt as soon as I double click it. Can I find out why?
Thanks, let me know if I should provide more details!
|
|
|
|
|
What does the check box "Run as administrator" show
(in the "Compatibility" property page of the result exe), please ?
Here is an example of "any-user" manifest,
that could be bind to an exe:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"
/>
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
virtual void BeHappy() = 0;
|
|
|
|