|
If I comment out that line, then the error does go away.
|
|
|
|
|
That specific error goes away or it compiles all the way through without errors? ...because if it compiles all the way without errors, then that is where the error is, if it just gives you a different error, then it may still be the original error, it may just be that the error message is misguiding you.
|
|
|
|
|
Make sure you're not conflicted in the namespace. All capital definitions are used for macros a lot, so you may be conflicting with a macro. Rename your type and length variable to something else and see if it clears the problem.
|
|
|
|
|
Thanks everyone for the help. I did turn out to be a macro conflict.
|
|
|
|
|
Don't forget to upvote...
I would say to also accept the answer but I'm even sure if you can accept a solution in the forums.
In any case, glad you found your issue. I would also consider changing those from all caps since it is the common way of labeling macros, although since you're aware of the possible issue, you should know to hold that suspect in the future.
|
|
|
|
|
Dear all:
I use winIo.dll with my project, when I call InstallWinIoDriver function, it always return false, but my application still work,
What happened? There are source code below
bool _stdcall InstallWinIoDriver(PWSTR pszWinIoDriverPath, bool IsDemandLoaded)
{
SC_HANDLE hSCManager;
SC_HANDLE hService;
RemoveWinIoDriver();
hSCManager = OpenSCManager(NULL, NULL,
SC_MANAGER_ALL_ACCESS);
if(hSCManager)
{
hService = CreateService(hSCManager, L"WINIO", L"WINIO",
SERVICE_ALL_ACCESS, SERVICE_KERNEL_DRIVER, (IsDemandLoaded
== true) ? SERVICE_DEMAND_START : SERVICE_SYSTEM_START,
SERVICE_ERROR_NORMAL, pszWinIoDriverPath, NULL, NULL, NULL,
NULL, NULL);
CloseServiceHandle(hSCManager);
if(hService == NULL)
return false; }
else
return false; CloseServiceHandle(hService); return true; }
Thanks for your help, Victor
|
|
|
|
|
I have no idea really. But it's always useful to have some trace-code that prints the result of GetLastError() and FormatMessage() . Something like:
<br />
<small>MY_TRACE (("CreateService() failed; %s\n", my_strerror(GetLastError())));</small><br />
-- Gisle V.
|
|
|
|
|
Hmmm,
Could be that the CreateService function[^] is returning either ERROR_DUPLICATE_SERVICE_NAME or maybe ERROR_SERVICE_EXISTS.
As previously stated GetLastError[^] is your friend.
cedricvictor wrote: but my application still work,
Keep in mind that if you do not have source code for winIo.dll ... it could also be installing the service.
Best Wishes,
-David Delaune
|
|
|
|
|
Dear Randor:
You are right. In other function, the service is exist.
So the function always return false.
Thank for your help, Victor
|
|
|
|
|
Hi friends & Gurus,
May i know is visual c++ 6 is free downloadable / freeware ?
Please update me the details.
Thanks & Regards,
TV Krishna Rayalu
|
|
|
|
|
It is neither freeware nor downlodable.
Veni, vidi, vici.
|
|
|
|
|
Thank you. But VB 6 is freeware it seems. correct me if iam wrong.
|
|
|
|
|
As far as I know VB6 is NOT free.
Veni, vidi, vici.
|
|
|
|
|
VC6 is not free. There were special versions for publication on media of C/C++ books. So you might get such a book to get the special VC6 version for non-commercial purposes (compiled programs will show a message at each start).
But VC 6 is outdated. There is no reason to use it anymore.
If you are looking for a free Visual Studio version, you can download the Express versions from Microsoft at http://www.visualstudio.com/downloads/download-visual-studio-vs[^].
|
|
|
|
|
Thank you Jochen, i need it for commercial purpose. It is for very old Visualstudio 6 project maintenence purpose i required vc++6.
|
|
|
|
|
If you don't want to convert the project to a newer VC version (which may be difficult), you can look for a used version. But note that those may not include the latest service packs (SP5 from 2003 and SP6 from 2004).
|
|
|
|
|
Thanks for the precautions i need to take , if it need to be upgrade.
But as of now it is just support work.
|
|
|
|
|
When I've had to use really old versions of something... I've gone to ebay and looked there. The other way would be if you have an MSDN subscription, since MS usually makes all versions of their IDEs available to developers to download through there, but a subscription is pricey to begin with (you'll likely find it cheaper through some third party online).
|
|
|
|
|
In OnTimer, I write a test program. if I don't use CreateCompatibleDC(), It works well, otherwise, no display.
Please help me to find the reason.
void CDynamicShowTextDlg::OnTimer(UINT nIDEvent)
{
CDC *pDC;
CRect tRect;
CDC MemDC;
pDC = this->GetDC();
GetClientRect(&tRect);
MemDC.CreateCompatibleDC(NULL);
MemDC.SetBkMode(TRANSPARENT);
if (test == 0 ){
MemDC.SetTextColor(RGB(255,255,255));
MemDC.DrawText(_T("My Test"),&tRect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
MemDC.SetTextColor(RGB(255,0,0));
MemDC.DrawText(_T("TEST"),&tRect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
}
else {
MemDC.SetTextColor(RGB(255,255,255));
MemDC.DrawText(_T("TEST"),&tRect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
MemDC.SetTextColor(RGB(0,150,0));
MemDC.DrawText(_T("My Test"),&tRect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
}
m_Seconds++;
m_TimerEcho.Format(_T("%d: Seconds have passed"), m_Seconds);
test ^= 1;
MemDC.DeleteDC();
ReleaseDC(pDC);
UpdateData(FALSE);
}
with pDC, it works well.
modified 17-Mar-14 11:40am.
|
|
|
|
|
You can see drawing operations occurred into a memory device context only if you BitBlt it to a 'standard' device context (see, for instance "CDC::CreateCompatibleDC" at MSDN[^].
Veni, vidi, vici.
|
|
|
|
|
I added a statement:
int nX = tRect.left + tRect.Width() / 2;
int nY = tRect.top + tRect.Height() / 2;
pDC->BitBlt(nX, nY, tRect.Width()/3, tRect.Height()/3, &MemDC,
0, 0, SRCCOPY);
But still get nothing on the screen.
|
|
|
|
|
you need to create a bitmap for your memdc to draw on.
see MSDN dox for CDC::CreateCompatibleDC:
http://msdn.microsoft.com/en-us/library/kwxzck32.aspx[^]
from the dox:
When a memory device context is created, GDI automatically selects a 1-by-1 monochrome stock bitmap for it. GDI output functions can be used with a memory device context only if a bitmap has been created and selected into that context.
|
|
|
|
|
Thanks, now the test string appeared.
But, the client area is black, and show text string in while color only, no change.
Please refer to the code:
void CDrawTextTstDlg::OnTimer(UINT_PTR nIDEvent)
{
CDC *pDC;
CRect tRect;
CDC MemDC;
pDC = this->GetDC();
GetClientRect(&tRect);
MemDC.CreateCompatibleDC(NULL);
CBitmap bmp;
bmp.CreateCompatibleBitmap(&MemDC, tRect.Width(), tRect.Height());
CBitmap *oldBitmap = MemDC.SelectObject(&bmp);
MemDC.SetBkMode(TRANSPARENT);
if (gtest == 0 ){
MemDC.SetTextColor(RGB(255,255,255));
MemDC.DrawText(_T("My Test"),&tRect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
MemDC.SetTextColor(RGB(255,0,0));
MemDC.DrawText(_T("TEST"),&tRect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
}
else {
MemDC.SetTextColor(RGB(255,255,255));
MemDC.DrawText(_T("TEST"),&tRect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
MemDC.SetTextColor(RGB(0,150,0));
MemDC.DrawText(_T("My Test"),&tRect,DT_CENTER|DT_VCENTER|DT_SINGLELINE);
}
pDC->BitBlt(0, 0, tRect.Width(), tRect.Height(), &MemDC,
0, 0, SRCCOPY);
m_Seconds++;
m_TimerEcho.Format(_T("%d: Seconds have passed"), m_Seconds);
gtest ^= 1;
MemDC.SelectObject(oldBitmap);
bmp.DeleteObject();
MemDC.DeleteDC();
ReleaseDC(pDC);
CDialog::OnTimer(nIDEvent);
}
|
|
|
|
|
bmp.CreateCompatibleBitmap(&MemDC, tRect.Width(), tRect.Height());
instead of MemDC there, use the DC that you used as the source for CreateCompatibleDC.
when a memory DC is created, it has a 1x1 pixel monochrome bitmap selected into it. if you create a bitmap compatible with that, you'll get a monochrome bitmap.
also, if you want a background color, you'll need to fill the bitmap with that color (CDC::FillSolidRect)
|
|
|
|
|
Thank you very much.
Now I can see the Text string color is changing.
While, the whole dialog screen is black too, some controls, static texts all disappeared.
Do I need to redraw all the controls like DrawText() ? and then BitBlt()?
The original dialog screen is white.
|
|
|
|
|