|
|
Absolutely not, but like prasad_som said we do not have enough information.
What is the prototype of ‘DrawLed”?
You did not give the header, and more importantly you did not state the library. Without those it is a total mystery.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
void CLed::DrawLed(CDC *pDC,int nLEDColor, int nMode, int nShape)
{
CRect rect;
GetClientRect(&rect);
if(rect.Width() >= LED_SIZE && rect.Height() >= LED_SIZE)
{
int nWidth = rect.Width();
int nHeight = rect.Height();
rect.left += (nWidth - LED_SIZE)/2;
rect.right -= (nWidth - LED_SIZE)/2;
rect.top += (nHeight - LED_SIZE)/2;
rect.bottom -= (nHeight - LED_SIZE)/2;
}
CBitmap TransBitmap;
TransBitmap.CreateBitmap(LED_SIZE,LED_SIZE,1,1,NULL);
CBitmap bitmapTemp;
CBitmap* pBitmap = &m_LedBitmap;
CDC srcDC;
CDC dcMask;
CDC TempDC;
TempDC.CreateCompatibleDC(pDC);
srcDC.CreateCompatibleDC(pDC);
dcMask.CreateCompatibleDC(pDC);
CBitmap* pOldBitmap = srcDC.SelectObject(pBitmap);
CBitmap* pOldMaskbitmap = dcMask.SelectObject(&TransBitmap);
bitmapTemp.CreateCompatibleBitmap(pDC,LED_SIZE,LED_SIZE);
CBitmap *pOldBitmapTemp = TempDC.SelectObject(&bitmapTemp);
TempDC.BitBlt(0, 0, LED_SIZE, LED_SIZE, pDC, rect.left, rect.top, SRCCOPY);
COLORREF OldBkColor = srcDC.SetBkColor(RGB(255,0,255));
dcMask.BitBlt(0, 0, LED_SIZE, LED_SIZE,&srcDC, nMode*LED_SIZE, nLEDColor+nShape, SRCCOPY);
TempDC.SetBkColor(OldBkColor);
TempDC.BitBlt(0, 0, LED_SIZE, LED_SIZE, &srcDC, nMode*LED_SIZE, nLEDColor+nShape, SRCINVERT);
TempDC.BitBlt(0, 0, LED_SIZE, LED_SIZE,&dcMask, 0, 0, SRCAND);
TempDC.BitBlt(0, 0, LED_SIZE, LED_SIZE, &srcDC, nMode*LED_SIZE, nLEDColor+nShape, SRCINVERT);
pDC->BitBlt(rect.left, rect.top, LED_SIZE, LED_SIZE, &TempDC, 0, 0, SRCCOPY);
srcDC.SelectObject(pOldBitmap);
dcMask.SelectObject(pOldMaskbitmap);
TempDC.SelectObject(pOldBitmapTemp);
VERIFY(srcDC.DeleteDC());
VERIFY(dcMask.DeleteDC());
VERIFY(TempDC.DeleteDC());
VERIFY(TransBitmap.DeleteObject());
VERIFY(bitmapTemp.DeleteObject());
}
SORRY for the late friends..
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
I have a VC++ console application that runs in VS 2005 but fails with an "unhandled win32 exception" when run in the command window. It exhibits this behavior for both the Debug and Release versions of the program, although the Release version does get a bit further along in execution before failing. To increase my frustration, when I accept its offer to debug with a copy of VS, it comes up with a "blank" VS, with no way to inspect state or anything (in Debug and Release). Any ideas on what might be causing this, how to track it down, or where I might look for more information or help would be greatly appreciated.
Regards,
- Roy
Always do right.
This will gratify some people and astonish the rest. - Mark Twain
The truth is rarely pure, and never simple. - Oscar Wilde
|
|
|
|
|
I had a similar problem some time ago with a quick and dirty console app I had knocked up. The problem turned out to be the difference in the environment between launching the app from the ide and from a console window. In my case I was opening a file without using a full path, and not checking that the open was successful (it was a Q&D app!), within the IDE it found the file in the project directory, whereas the starting directory from a console window was different. So one place to start looking may be to see if you are susceptible to differences in environment.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
Thank-you. Unfortunately, I took great care to make sure the input was the same in both cases and always used full path names. There is file activity, but based on the program output before it failed, I know I don't have this problem. In fact, the program output of the working (VS) execution and the failing one is exactly the same up to the failure point.
Regards,
- Roy
Always do right.
This will gratify some people and astonish the rest. - Mark Twain
The truth is rarely pure, and never simple. - Oscar Wilde
|
|
|
|
|
In that case all I can suggest is manual debugging - when I need it I use an ofstream with lots of output traces to find the crash point. If you always terminate an output with an endl then the output stream is continually flushed.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
Hi All,
I have small application that i add in it some CTreeCtrl control.
In this i need in some cases to disable one of the sub item of some root element and i don't know how to do it.
Some one can help me ?
Thanks.
p.s : i need to disable only the sub item without the root item.
|
|
|
|
|
|
I'm not sure if this is right board.... Does anyone know if there are problems using msscript.ocx in multithreaded environment? specificaly I'm using it from C++ COM object that is called from IIS. Each clients session has an object for processing some vbscripts. What I'm seeing is that if one client destroys the msscript object/ or even just calls "reset" on it another object of it on another thread dies as well. - cut right in a middle of a vb call
Please help!
"personal world record"
|
|
|
|
|
Hello all,
I recently took an internship (I'm a junior Computer Engineering major). I've had a lot asked of me, especially for an intern but have come out ok so far after many headaches. Now, I have come to something I just can't quite understand. We need to be able to digitize from a video capture card to an mpeg file. I've read through some stuff about DirectShow, which is what I am supposed to use, but can't quite get my mind around everything. Does anyone know of code or examples I can reference for something like this? Any help would be greatly appreciated!
Dave Wilson
|
|
|
|
|
If you haven't already, download the Platform SDK, which contains the DirectShow sdk...
Windows® Server 2003 SP1 Platform SDK Web Install[^]
The DirectShow base classes are handy (and recommended) for filter development and the sample
applications are pretty decent.
For MPEG encoding, there's no free codecs included except the Windows Media MPEG-4 encoder which
can be accessed using the WM ASF Writer Filter. For other flavors of MPEG you'll need a 3rd-party
codec or roll your own.
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
Don't use SYSTEM_FONT , that's still around only for compat with Win 3.1. There are many MS blog posts about the right font to use, start with this canned search[^].
|
|
|
|
|
found that DEFAULT_GUI_FONT goes the trik before seeing this post ,thanks anyway
-- modified at 16:50 Thursday 22nd March, 2007
|
|
|
|
|
Michael,
I was wondering how your answer and others ended up hanging in empty space. I agree with your statement about SYTEM_FONT , up to a point. But what was the original question?
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
For some reason, the OP deleted their post.
|
|
|
|
|
Hi folks
I've created a class that create dynamic menus this is the code of the method that creates hte menus:
<br />
void Menu::InsertNewMenuItem(HMENU hParentMenu, HWND hwWindowOwner, unsigned int uiMenuID, unsigned int uiMenuBehavior, char * cMenuText)<br />
{<br />
int iSize = m_uiMenuID.size();<br />
m_uiMenuID.push_back(uiMenuID);<br />
m_uiBehavior.push_back(uiMenuBehavior);<br />
m_cMenuName.push_back(cMenuText);<br />
if(iSize <= 0)<br />
{<br />
AppendMenu(hParentMenu, m_uiBehavior[0], m_uiMenuID[0], m_cMenuName[0]);<br />
m_hSubMenu = CreateMenu();<br />
}<br />
else<br />
{<br />
AppendMenu(m_hSubMenu, m_uiBehavior[iSize], m_uiMenuID[iSize], m_cMenuName[iSize]);<br />
AppendMenu(hParentMenu, m_uiBehavior[0], (unsigned int)m_hSubMenu, m_cMenuName[0]);<br />
}<br />
SetMenu(hwWindowOwner, hParentMenu);<br />
}<br />
This code is in my callback
<br />
LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT uiMessage, WPARAM wParam, LPARAM lParam)<br />
{<br />
HMENU hMainMenu = CreateMenu();<br />
char * cMainName = "Principal1";<br />
char * cName1 = "Menu 1";<br />
char * cName2 = "Menu 2";<br />
char * cName3 = "Menu 3";<br />
char * cName4 = "Menu 4";<br />
char * cName5 = "Menu 5";<br />
char * cName6 = "Principal2";<br />
char * cName7 = "Menu 7";<br />
char * cName8 = "Menu 8";<br />
char * cName9 = "Menu 9";<br />
char * cName10 = "Menu 10";<br />
int iIDS[] = {6000, 6001, 6002, 6003, 6004, 6005, 6006, 6007, 6008, 6009, 6010};<br />
switch(uiMessage)<br />
{<br />
case WM_CREATE:<br />
{<br />
theMenu = new Menu();<br />
theMenu2 = new Menu();<br />
break;<br />
}<br />
case WM_CHAR:<br />
{<br />
switch(wParam)<br />
{<br />
case 'a':<br />
{<br />
theMenu->InsertNewMenuItem(hMainMenu, hwnd, iIDS[0], MF_STRING|MF_POPUP, cMainName);<br />
DrawMenuBar(hwnd);<br />
break;<br />
}<br />
case 's':<br />
{<br />
theMenu2->InsertNewMenuItem(hMainMenu, hwnd, iIDS[1], MF_STRING, cName1);<br />
DrawMenuBar(hwnd);<br />
break;<br />
}<br />
.....<br />
The problem that I have is: I have 2 menus. When I call the method pressing "a", a submenu is inserted in the first menu. When I call the method pressing "s" to insert a new submenu in the OTHER menu, the first one is overlapped with the first. The same is valid when I insert a submenu in the second menu and insert a valid a submenu in the first menu.
What going on? It's very strange. Am I clear enough for you?
|
|
|
|
|
The first problem I see is that you're calling
HMENU hMainMenu = CreateMenu(); for every window message, I don't think that is what you're after. You can get your window's menu with GetMenu() .
|
|
|
|
|
Hi,
I wanna make an app and in the about box to have a small animated 3D thingy with DirectX but dont want to static link* to d3d.lib or w/e ....
except LoadLibrary and GetProcAddress for every dll and proc i need, is there another way
*this is because ,if the target machine doesnt have directx ,should run but the about box should say "...no directx... bla bla" u understand what is what i want right?
|
|
|
|
|
shaderx wrote: I wanna make an app and in the about box to have a small animated 3D thingy with DirectX but dont want to static link* to d3d.lib or w/e ....
You mean you don't want dynamic linking but static linking ? I don't thing that is possible.
shaderx wrote: except LoadLibrary and GetProcAddress for every dll and proc i need, is there another way
That is still dynamic linking, except that you explicitely load the dll (but you still need the dll to be present on the target machine).
shaderx wrote: u understand what is what i want right?
I'm not so sure...
In brief, you will need to distribute DirectX with your application if you want to use it.
|
|
|
|
|
shaderx wrote: if the target machine doesnt have directx
I think DirectX came installed on all current OS supported by Microsoft so that should not happen. What may not be present is the Version you coded against. See this[^]
led mike
|
|
|
|
|
AFAIK there is no static lib version of DirectX.
|
|
|
|
|
i see ppl dont understand what i mean,and what i mean is:
is there an easyer way to use diretx without linking at load time with it , except LoadLibray and GetCrocAddress for every proc ?
|
|
|
|
|
shaderx wrote: is there an easyer way to use diretx without linking at load time with it , except LoadLibray and GetCrocAddress for every proc ?
I believe what people mean is "no, there isn't".
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
//hi the type of threading im using is..
#include
#include
using namespace std;
int shutdown=0;
int main(){
unsigned sid;
(HANDLE)_beginthreadex( NULL, 0, threadprocess, NULL, 0, &sid);
while(1){
Sleep(1000);
if(shutdown==1){ break; }
}
}
unsigned __stdcall threadprocess(void *params){
return 0;
}
//What i need to do is pass a string from the main() to the threadprocess.. Please Help.
//I alsot need to send a string back to the main process
//Could be a SOCKET i need to pass back or something for example
//but i know i could just put global string but it needs to separate per proccess ran...
-- modified at 14:47 Thursday 22nd March, 2007
|
|
|
|
|