|
CPallini wrote: I think the correct declaration (inside attributeimpl class) should be:
template <typename t,="" typename="" p="">
friend attribute * MakeAttribute(
const string & table,
const string & column,
factory * fac,
T P::* member
);
However, the modified code has still troubles with the linker, on my VS 2010.
The example was not made to link correctly.
Anyway - your suggestion solved the problem.
I always believed that the compiler uses the template parameters from the class where the friend was declared in, but I was obviously wrong...
CPallini wrote: BTW: did the code author contributed to ATL?
Sure not
The whole library was written in plain C++ with STL.
Many thanks for the help!
|
|
|
|
|
In CMyApp::InitInstance
SwfWnd * w = new SwfWnd;
SwfWnd->Create(...);
MSG msg;
While(GetMessage(&msg, SwfWnd->GetHWnd, 0, 0))
{
TranlateMessage(&msg);
Dispatch(&msg);
}
SwfWnd * w = new SwfWnd;
SwfWnd->Create(...);
COtherDlg dlg;
dlg.DoModal();
Any way to make the 1st version work?
|
|
|
|
|
Did you assign the address of the control to the m_pMainWnd member of the CWinApp object before running the message loop ?
Push Framework - now released !
http://www.pushframework.com
|
|
|
|
|
tried, but still not work
if popup the context menu, it plays
|
|
|
|
|
Hi,
i have created a dialog based application in vc 8 for excel automation .
#import \
".\MSO.DLL" \
rename("DocumentProperties","DocumentPropertiesXL") \
rename("RGB", "RGBXL")
#import \
".\VBE6EXT.OLB"
#import ".\EXCEL.EXE" \
rename("DialogBox", "DialogBoxXL") rename("RGB", "RGBXL") \
rename("DocumentProperties", "DocumentPropertiesXL") \
rename("ReplaceText","ReplaceTextXL") \
rename("CopyFile","CopyFileXL") \
exclude("IFont","IPicture") no_dual_interfaces
When i m using the wrapper class, i m getting the following errors.
1>------ Build started: Project: Test_excel, Configuration: Release Win32 ------
1>Compiling...
1>StdAfx.cpp
1>e:\my projects\test_excel\release\mso.tlh(19948) : error C2059: syntax error : 'constant'
1>e:\my projects\test_excel\release\mso.tlh(19948) : error C2238: unexpected token(s) preceding ';'
1>e:\my projects\test_excel\release\mso.tlh(20352) : error C2059: syntax error : 'constant'
1>e:\my projects\test_excel\release\mso.tlh(20352) : error C2238: unexpected token(s) preceding ';'
1>e:\my projects\test_excel\release\mso.tlh(25155) : error C2589: 'constant' : illegal token on right side of '::'
1>e:\my projects\test_excel\release\mso.tlh(25155) : warning C4091: '' : ignored on left of 'long' when no variable is declared
1>e:\my projects\test_excel\release\mso.tlh(25155) : error C2143: syntax error : missing ';' before '::'
1>e:\my projects\test_excel\release\mso.tlh(25155) : error C2059: syntax error : '::'
1>e:\my projects\test_excel\release\mso.tlh(25242) : error C2589: 'constant' : illegal token on right side of '::'
1>e:\my projects\test_excel\release\mso.tlh(25242) : warning C4091: '' : ignored on left of 'long' when no variable is declared
1>e:\my projects\test_excel\release\mso.tlh(25242) : error C2143: syntax error : missing ';' before '::'
1>e:\my projects\test_excel\release\mso.tlh(25242) : error C2059: syntax error : '::'
1>e:\my projects\test_excel\release\excel.tlh(29621) : error C2059: syntax error : 'constant'
1>e:\my projects\test_excel\release\excel.tlh(29621) : error C2238: unexpected token(s) preceding ';'
1>e:\my projects\test_excel\release\excel.tlh(30002) : error C2059: syntax error : 'constant'
1>e:\my projects\test_excel\release\excel.tlh(30002) : error C2238: unexpected token(s) preceding ';'
1>e:\my projects\test_excel\release\excel.tlh(35825) : error C2059: syntax error : 'constant'
1>e:\my projects\test_excel\release\excel.tlh(35825) : error C2238: unexpected token(s) preceding ';'
1>e:\my projects\test_excel\release\excel.tlh(74947) : error C2059: syntax error : 'constant'
1>e:\my projects\test_excel\release\excel.tlh(74947) : error C2238: unexpected token(s) preceding ';'
1>e:\my projects\test_excel\release\excel.tlh(76532) : error C2059: syntax error : 'constant'
1>e:\my projects\test_excel\release\excel.tlh(76532) : error C2238: unexpected token(s) preceding ';'
1>e:\my projects\test_excel\release\excel.tlh(76979) : error C2059: syntax error : 'constant'
1>e:\my projects\test_excel\release\excel.tlh(76979) : error C2238: unexpected token(s) preceding ';'
1>e:\my projects\test_excel\release\excel.tlh(86803) : error C2589: 'constant' : illegal token on right side of '::'
1>e:\my projects\test_excel\release\excel.tlh(86803) : warning C4091: '' : ignored on left of 'long' when no variable is declared
1>e:\my projects\test_excel\release\excel.tlh(86803) : error C2143: syntax error : missing ';' before '::'
1>e:\my projects\test_excel\release\excel.tlh(86803) : error C2059: syntax error : '::'
1>e:\my projects\test_excel\release\excel.tlh(86932) : error C2589: 'constant' : illegal token on right side of '::'
1>e:\my projects\test_excel\release\excel.tlh(86932) : warning C4091: '' : ignored on left of 'long' when no variable is declared
1>e:\my projects\test_excel\release\excel.tlh(86932) : error C2143: syntax error : missing ';' before '::'
1>e:\my projects\test_excel\release\excel.tlh(86932) : error C2059: syntax error : '::'
1>e:\my projects\test_excel\release\excel.tlh(88372) : error C2589: 'constant' : illegal token on right side of '::'
1>e:\my projects\test_excel\release\excel.tlh(88372) : warning C4091: '' : ignored on left of 'long' when no variable is declared
1>e:\my projects\test_excel\release\excel.tlh(88372) : error C2143: syntax error : missing ';' before '::'
1>e:\my projects\test_excel\release\excel.tlh(88372) : error C2059: syntax error : '::'
1>e:\my projects\test_excel\release\excel.tlh(94797) : error C2589: 'constant' : illegal token on right side of '::'
1>e:\my projects\test_excel\release\excel.tlh(94797) : warning C4091: '' : ignored on left of 'long' when no variable is declared
1>e:\my projects\test_excel\release\excel.tlh(94797) : error C2143: syntax error : missing ';' before '::'
1>e:\my projects\test_excel\release\excel.tlh(94797) : error C2059: syntax error : '::'
1>e:\my projects\test_excel\release\excel.tlh(95039) : error C2589: 'constant' : illegal token on right side of '::'
1>e:\my projects\test_excel\release\excel.tlh(95039) : warning C4091: '' : ignored on left of 'long' when no variable is declared
1>e:\my projects\test_excel\release\excel.tlh(95039) : error C2143: syntax error : missing ';' before '::'
1>e:\my projects\test_excel\release\excel.tlh(95039) : error C2059: syntax error : '::'
1>e:\my projects\test_excel\release\excel.tlh(95143) : error C2589: 'constant' : illegal token on right side of '::'
1>e:\my projects\test_excel\release\excel.tlh(95143) : warning C4091: '' : ignored on left of 'long' when no variable is declared
1>e:\my projects\test_excel\release\excel.tlh(95143) : error C2143: syntax error : missing ';' before '::'
1>e:\my projects\test_excel\release\excel.tlh(95143) : error C2059: syntax error : '::'
1>Build Time 0:03
1>Build log was saved at "file://e:\My Projects\Test_excel\Release\BuildLog.htm"
1>Test_excel - 40 error(s), 8 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
How to correct these errors?
please help me for this.
Thanks in advance,
|
|
|
|
|
Check file e:\my projects\test_excel\release\mso.tlh on line 19948. There is something there the compiler doesn't understand.
|
|
|
|
|
I am trying to use ITextHost(see http://support.microsoft.com/kb/270161/).
dwStyle = ES_MULTILINE;<br />
fHidden = TRUE;<br />
<br />
fRich = FALSE;<br />
The problem is, when the bottom line is empty the vert scrollbar can not scroll to bottom
is there way to accomplish this?
Thanks in advance!
tangwang han
66
|
|
|
|
|
hello guys... I need to get the file path of the current document that im using. For example if I am using MyMainClass.cpp as the current document in VS 2008 then I want to get the full file path of the current document and print in console app. Using google I got to GetModuleFileName() but dont know whether it is the right function or not.
modified on Monday, February 21, 2011 1:17 PM
|
|
|
|
|
Your question is not clear. Do you want to get the path of the source module you have open in Visual Studio? Then GetModuleFileName() won't do it. That will get you the full path of the running executable.
|
|
|
|
|
overloaded Name wrote: hello guys... I need to get the file path of the current document that im using.
Check out CDocument::GetPathName() .
"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
|
|
|
|
|
OK, here is a func i wrote for stripping new lines:
wchar_t * StripNL(IN wchar_t *buff)
{
int len = wcslen(buff);
wchar_t *temp = (wchar_t *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(wchar_t *) * len + 1);
int x = 0;
for (int i = 0; i < len; i++)
{
if(buff[i] != '\n' && buff[i] != '\r\n')
{
temp[x] = buff[i];
x++;
}
}
temp = (wchar_t *)HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
temp, sizeof(wchar_t *) * wcslen(temp) + 1);
return temp;
}
Here is some dirty array constructor function, it returns array where strings including new lines:
wchar_t **sss(int &lll)
{
wchar_t *Arr[] = {L"\r\ntest test\n\n", L"test\r\n\r\n so be it\n\n"};
for (int i = 0; i < (sizeof(Arr) / sizeof(wchar_t *)); i++)
{
lll++;
}
return Arr;
}
Now i am trying to strip new lines from array's strings like that:
int elems = 0;
wchar_t **Arr = sss(elems);
for (int i = 0; i < elems; i++)
{
wprintf(L"elems: %s, len = %d\r\n", StripNL(Arr[i]), wcslen(Arr[i]));
}
Now this behaves completely crazy. WHile it should output:
elems: test test, len = some len
elems: test so be it, len = some len
it prints this:
test test, len = some len
so be it, len = some len
And then app crashes. So it strips something that is shouldnt. It looks like memory gets overwritten somewhere, but i cannot see where exactly?
Thanks
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
|
C++ is not the way.
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
Ah, i was so pathetically lame - cant stand myself. Shame on me!
if(buff[i] != '\n' && buff[i] != '\r')
{
temp[x] = buff[i];
x++;
}
Works perfectly. That was '\r' char unparsed which messed up everything.
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
I'd expect a compiler error on the original code; single quotes mean a character is between them and \r\n is two characters.
If you still want to check for \r\n rather than for any occurence of \r separately, you could use something like this:
for (int i = 0; i < len; i++)
{
if(!(buff[i] == '\n' || (buff[i] == '\r' && i+1 < len && buff[i+1] == '\n')))
{
temp[x] = buff[i];
x++;
}
}
modified 13-Sep-18 21:01pm.
|
|
|
|
|
Nope, there was no error. That was silly mistake
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
I suppose you do a HeapFree call somewhere, however
temp = (wchar_t *)HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
temp, sizeof(wchar_t *) * wcslen(temp) + 1);
is a bit dangerous. HeapReAlloc might return NULL, in which case you have no chance of freeing the memory since you're overwriting the only access you have to it.
You should always use a temporary pointer for the return value.
wchar_t* temp2 = (wchar_t *)HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
temp, sizeof(wchar_t *) * wcslen(temp) + 1);
if (temp2 != NULL)
temp = temp2;
else
Error handling and HeapFree temp pointer
|
|
|
|
|
Everything is under control :P There are memory checks outside of the function i posted here, and, it is not complete here (code was meant to just present en error situation). However, thank you for suggestions about HeapRealloc
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
I want to capture the desktop image behind my main window.I used
HDC hDesktopDC = GetDC(NULL);
RECT rect;
GetWindowRect(&rect);
......
BitBlt(hMemDC, 0,0, nWidth, nHeight, hDesktopDC, rect->left, rect->top, SRCCOPY);
hBitmap = (HBITMAP)SelectObject(hMemDC, hOldBitmap);
but, the image I got was my window,not Its background.
what's the matter?
How could I get the image behind my main window?
Thanks guys!
|
|
|
|
|
Hide your window first by calling ShowWindow(hwnd, SW_HIDE) .
|
|
|
|
|
thanks hans.
that would be fine,but there is always a flash.not perfect.
|
|
|
|
|
You can minimize your application window first and then get the hWnd to the desktop window using the GetDesktopWindow.[^]Then you can maximize your application back again.
I am a HUMAN. I have that keyword in my name........
_AnsHUMAN_
|
|
|
|
|
You could manipulate the clipping region for the desktop window before having it paint itself.
|
|
|
|
|
Dear All,
I have a main modeless dialogbox created by CreateDialog and have another child model dialog box created by DialogBox and on this child window I have many button but when I am clicking on any button WM_COMMAND is not getting fired in winproc of child dialog.
I will be very thankful for your support.
With regards
RYK
|
|
|
|
|
There is only a few reasons I can think of why this is happening:
1. Make sure you are looking in the right place for the message. I know it seems trivial, but it happens to everyone.
2. Make sure you set the right MsgProc for the child dialog.
3. Make sure something else isn't replacing the MsgProc for the child dialog (such as MFC)
Spy++ is distributed with Visual Studio, and can be found under the tools menu. Follow these steps to debug using Spy++.
Run your program and open the child dialog where the problems are
Start Spy++ from the Tools menu
Find your child dialog window, either in the list or using the find window toolbar icon
Right click on your child dialog window in the list and select Messages
Click some buttons in your program to see if they show up in the list
You can also check things like check the memory address of the MsgProc and window styles by selecting properties from the right click menu.
|
|
|
|