 |
 |
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
 |
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
 |
We use the CMFCRibbonBar defined from a resource file. We have a recent files list appearing to the right of the main menu (which contains New, Open, Print etc). The problem is that the elements are too widely spaced, which stands out as it does not match the other menus. Anyone know how to fix this?
For our Print sub-menu I was able to get 'correct' spacing of the menu items by editing the ribbon resource file and setting the value to FALSE for each item. Unfortunately I cannot do this for file list items, and I cannot get each recent file list button using CMFCRibbonBar::FindByID(ID_FILE_MRU_FILE1+index) as it returns NULL.
|
|
|
|
 |
I want to control the device with my programm.
How to get info from video capture card PEXHDCAP with no SDK or similar. I think I can only dissassemble the software / driver like hackers do.
Is there any expert who can find out how to control this device with own software ?
|
|
|
|
 |
Dear sir/madam,
Please share any example online website code using c++ language .I need it in my entry level engineer interview.Please help me out in this regard.
Rathnasri Adepu
|
|
|
|
 |
If you cannot answer your interview questions by your own efforts, then the answers have no value.
|
|
|
|
 |
True.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
|
|
|
|
 |
Dear all:
I have two touch screens and dual monitor, I try to match touch screen for each monitor in windows xp.
I can do it in mirror mode and extended mode, but failed in span
mode.
I use the EnumDisplayMonitor to get the monitor count, but the monitor count is 1 in span mode.
How do I know my dual diplay in span mode and get the monitor count?
best regards, Victor
modified 7 hrs ago.
|
|
|
|
 |
Hi All,
I am writing a program to control some I/O card under Win8.1 environment, however, initialisation winio always fail. There is no problem under WinXP or Win7, so I guess it is caused by Win8.1 UEFI blocked the WINIO.
Is there anyone who can give me a solution?
Thanks
Eric
|
|
|
|
 |
It is unlikely that anyone can give a solution, unless you provide a lot more information. Where does the failure occur, what are the conditions, what error status or message do you see ... ?
|
|
|
|
 |
When I perform
DWORD dwMemVal;
bool bResult;
HANDLE hPhysicalMemory;
PBYTE pbLinAddr;
// Call InitializeWinIo to initialize the WinIo library.
ShutdownWinIo();
bResult = InitializeWinIo();
the bResult keeps 0, so I cannot initialize WinIO
However, I tried to create a virtual machine with WinXP installed, using the same sourecode without any problem. Thus, I guess it is caused by Win8.1 UEFI which protect the BIOS controlled by WinIO.
Would there be anyone who can help me to fix this problem? Thanks a lot for any help.
|
|
|
|
|
 |
Hi
I tried to put the same program in Win8.0 and it works without the need to sign-up WINIO.
I would like to know what is the different between Win8 and 8.1?
Thanks
|
|
|
|
 |
Hi, in a windows CE platform, I tested BitBlt() function,
I found it will take about 400 millisecdons to do:
MemBoard.CreateCompatibleDC(&dc);
bmpDashBoard.LoadBitmap( IDB_SCREEN_IMP );
pOldBmp = (CBitmap*)Memboard.SelectObject(&bmpBoard);
...
MemDC.CreateCompatibleDC(dc);
..
MemDC.BitBlt(0,0, 800,600,&Memboard, 0, 0, SRCCOPY);
is there anyway to speed up BitBlt() function?
|
|
|
|
 |
are you saying it takes 400ms to do all of that, or just the BitBlt?
because you can do the LoadBitmap ahead of time and just keep the CBitmap around for when you need it.
|
|
|
|
 |
I can't get precise time, but, with old BitBlt(), not a 800*600 bitmap,
I set tick count array in program, tkCount[15]-tkCount[14] = tkCount[14] - tkCount[13] ... = tkCount[1] - tkCount[0] = 170 ms around.
Then I use new BitBlt() to load 800*600 bitmap, it gives 400ms around.
So I should say it added 230 ms.
Old BitBlt() just transport about 1/5 or 1/6 part of 800*600 bitmap.
I expected to use a 800*600(the screen area) memory DC to hold all parts changes, then BitBlt() to screen.
Now that 800*600 tooks so much time, I don't think a double buffer technique is helpful.
|
|
|
|
 |
what do you mean "old" and "new" BitBlt ?
|
|
|
|
 |
I doubt it's the BitBlt slowing you down that much. You probably shouldn't be loading a bitmap every single time, load it once and keep it in memory for better results.
|
|
|
|
 |
Yes, I know redraw picture is a time-costing work.
But, the application need to update picture with the real-time data.
|
|
|
|
 |
I do real-time drawing... bitblt() is your friend, you're probably doing something else that's slow.
|
|
|
|
 |
The background picture is 800*600, 24 color depth, so it is about 1.44 MB.
Did you think the picture size would affect the BitBlt() speed?
|
|
|
|
 |
I'm sure it would... but not to the extent that your numbers reflect. You're doing something else wrong (or... more precisely, you're doing something else that's slowing the process down).
|
|
|
|
 |
How much time does it take to do the other 4 lines?
|
|
|
|
 |
It seems 1-3 ms, based on tickcount() result
|
|
|
|
 |
Do you handled CDC::SetStretchBltMode[^] ? Depend on this settings, you will have rendering speed or render quality ...
|
|
|
|
 |
Thanks, I will read descriptions of this function
|
|
|
|
 |
Hey why not using DirectX ,it uses Double buffering algorithm
|
|
|
|
 |
Thanks,image without dirctx components inside
|
|
|
|
 |
Hi, I have a question, situation like:
void funcA()
{
CDC MemDC;
CDC *pDC ;
pDC = GetDC();
memDC.CreateCompatibleDC(pDC);
funcB(memDC);
}
void funcB(CDC *pDC)
{
HDC hdc;
HDC hdcMem;
hdc = pDC->m_hDC;
hdcMem = CreateCompatibleDC(hdc);
...
BitBlt(hdc,0,0,100,100,hdcMem,0,0,SRCCOPY);
}
I think this BitBlt() will copy hdcMem to MemDC(in FuncA), right? just want to confirm it.
|
|
|
|
 |
What exactly are you trying to achieve?
|
|
|
|
 |
I want funcB draw picture on it's own temporary DC, then paste on funcA's memory DC, and FuncA paste the whole funcA's DC to screen.
Like:
B -> A
c -> A
...
x -> A
and A -> screen.
And I had another question, I have a big bitmap, represent the screen, many parts of the bitmap need to update independently and frequently.
is it a good idea using one memory DC to hold
all part's temporary DC, then post the whole memory DC to screen? that is, the double buffering technique.
|
|
|
|
 |
1. Sounds OK. What happens when you try it?
2. Yes, keeping a MemDC with all the information and then updating that, before blitting to screen is probably the best way.
|
|
|
|
 |
Thanks, have not try it.
Just thinking if the way is reasonable.
|
|
|
|
 |
Trying things is the best way to learn.
|
|
|
|
 |
Hi,I wonder how a bitblt function of a CDC object, which src is a HDC object?
like:
MemDC.BitBlt(Icon.pos_x, Icon.pos_y, bm.w, bm.h,HdcObject,0,0,SRCCOPY);
|
|
|
|
 |
Quote: which src is a HDC object?
What? That doesn't make sense. Try rephrasing or expand on what you're trying to ask.
|
|
|
|
 |
I mean HdcObject in the code.
I just want to copy a HDC object to CDC object, use CDC object's BitBlt() function.
|
|
|
|
 |
HDC is a handle not an object....
You can use CDC::FromHandle() to get a temporary object for immediate use. Alternatively, you can CDC::Attach() to keep a more permanent CDC object around. You should make sure you release a device context (DC) when you're done using it (FromHandle sort of automatically handles this situation by going out of scope).
If you have CWnds, you can also get a pointer to an existing CDC with CWnd::GetDC().
There is a lot of info on drawing in GDI online, I suggest you read up on it.
|
|
|
|
 |
Hello, I get this error when I try to create a new project wi h Visual Studio 2010 (XP), Win32, MFC or Forms (only VB works)
"Object reference not set to an instance of an object"
I found nothing with Google for this case (just creating a new project) and tried to uninstall/install, repair, n times, impossible to fix
Thanks in advance for any idea, I'm desperate, unable to create even an empty Win32 project !
|
|
|
|
 |
Looks like a Visual Studio problem, but impossible to guess what.
|
|
|
|
 |
But it appeared just recently, it had worked for years before
|
|
|
|
 |
I can only assume that something has been corrupted somewhere. But as I said before, it's impossible to guess what. Your only chance is to collect all the information that you can, and report it to Microsoft.
|
|
|
|
 |
How can I get the CListCtrl scrollbar rectangle ? Whether the scrollbar is visible or not, I tested in following way:
if(GetStyle() & WS_VSCROLL)
{
}
but, in order to change the scrollbar background by DrawThemeBackground[^], I need the scrollbar rectangle ... how can I retrieve the scrollbar rectangle ?
|
|
|
|
|
 |
Thank you Jochen ... the rectangle is retrieve it ...
I have to dig in, because it seems that something is wrong in my code, because though rectangle is correct now, the color of scrollbar is not drawn ...
void CGridCtrlExt::OnDraw(CDC* pDC)
{
HTHEME hTheme = OpenThemeData(m_hWnd, L"WINDOW");
if(NULL != hTheme)
{
if(WS_VSCROLL & GetStyle())
{
SCROLLBARINFO si;
si.cbSize = sizeof(SCROLLBARINFO);
GetScrollBarInfo(OBJID_VSCROLL, &si);
CRect rect(si.rcScrollBar);
pDC->FillSolidRect(&rect, RGB(255, 255, 0));
DrawThemeBackground(hTheme, pDC->GetSafeHdc(), WP_VERTSCROLL, VSS_NORMAL, &rect, NULL);
}
CloseThemeData(hTheme);
}
}
|
|
|
|
 |
This may be because the scroll bar is redrawn by the system.
You may use a custom drawn scroll bar or handle WM_CTLCOLOR when you only need to change the background.
Searching the web may give you some solutions. The article http://www.drdobbs.com/windows/developing-a-custom-windows-scrollbar-in/184416659[^] is rather old but contains a good introduction and shows how to implement a custom drawn scroll bar.
|
|
|
|
|
 |
"This may be because the scroll bar is redrawn by the system"
I wonder if I put properly the scrollbar coloring code ... inside of CMyControl::OnDraw is ok ? I guess not ...
|
|
|
|
 |
OnDraw is a CView member function. You probably mean some kind of custom / owner draw. But this won't work for the scroll bars of list controls because only the list control content can be changed by this method. The scroll bar is still drawn by the system when necessary and your drawing vanishes.
If handling WM_CTLCOLOR did not work (and I believe meanwhile that it does not work with list controls), the only solution is using a complety custom drawn control or another GUI framework like Qt.
|
|
|
|
 |
Thank you so much for your attention Jochen !
In the real situation, I used an CGridCtrl, and this control has CGridCtrl::OnDraw to drawing itself ... but there is no difference between this kind of control or CListCtrl, or CListBox ... I had tried to change the color of the scrollbars of these last ones and I didn't succeded ...
After all, CGridCtrl is derived from CWnd, so is the same matter ... Should be a chance to move that code on some handler that is called after the system is redrawing the scrollbars ? ... who knows ...
I should dig in ...
modified 5 days ago.
|
|
|
|