|
|
when you use CColorDialog dlg ; how do you get the rgb value of the color you picked?
|
|
|
|
|
|
locoone wrote: how do you get the rgb value of the color you picked
To get RGB value what Gavin said is fine.
To get values of Red , Green , and Blue from a COLORREF you have to use:
BYTE nRed = GetRValue(clrRef);
BYTE nGreen = GetGValue(clrRef);
BYTE nBlue = GetBValue(clrRef);
For more details on how this works take a look in MSDN.
Jesus Loves <marquee direction="up" height="40" scrolldelay="1" step="1" scrollamount="1" style="background:#aabbcc;border-bottom:thin solid 1px #6699cc">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
I was going to leave that bit as an learning excerse for the guy...
Now they'll have to put off learning to read the MFC documentation for another day...
Gavin Taylor
w: http://www.gavspace.com
|
|
|
|
|
|
|
We've all seem examples of simple web servers that use Winsock. When you're running one of these you can browse to an address like "http://127.0.0.1/" and, say, browse the contents of a folder as if it was a website - And it works in IE and Firefox and other browsers. If you're on a network other machines can access it using your IP address. Is it possible to create the sockets in such a way that it is only accessible from the local machine?
Steve
|
|
|
|
|
You could either filter out incoming requests using a firewall or better yet when you create the listening socket only bind[^] it to the IP "127.0.0.1" that way it's only ever visible to the localhost.
Gavin Taylor
w: http://www.gavspace.com
-- modified at 22:28 Monday 23rd January, 2006
|
|
|
|
|
Ta,
Thanks for your help. I'll give it a burl.
Steve
|
|
|
|
|
Greetings,
I am using Visual C++ .NET 2003.
How do I add event handlers for a custom toolbar that I created? In my SDI app, I created, attached to the the main frame, but I can't find a way to create event or message handlers for the buttons. It's just sitting there...any help you can provide would be great.
Finally, last question: I know that you have to tell Visual C++ .NET if you want a class to be serializable. My question is, supposed the class contains other class objects as variable (i.e. a CAutomobile class has a member variable of type CEngineType), do I have to also tell Visual C++ that I also need to serialize the member object class (i.e. CEngineType) of the already serializable overall class (i.e. CAutomobile). Also, how does it work for derived classes?
Thanks for all of your help.
|
|
|
|
|
BlitzPackage wrote: custom toolbar that I created
How did you create this custom toolbar . Is it inherited from CToolBar ?
Jesus Loves <marquee direction="up" height="40" scrolldelay="1" step="1" scrollamount="1" style="background:#aabbcc;border-bottom:thin solid 1px #6699cc">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Yes, it is inherited from CToolBar. (I decided to use that instead of CToolBar Ctrl.)
|
|
|
|
|
|
Thanks again for replying.
Can you show me what you mean? Are you talking about a message map?
|
|
|
|
|
|
Hi
Will like to ask if anyone has ever try opening a comport with baudrate other than those even in Microsoft APIs? like BaudRate of 141250 etc?
I have a device that will work best with this baudrate but could not set the comport baudrate to this value for communication?
|
|
|
|
|
The Windows API supports any baud rate, but the driver and COM port usually only support a standard set of baud rates (integer factors of 115200; a legacy hardware limitation). If your COM port and driver supports other baud rates, then Windows won't stop you using them.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
As Ryan says, the standard PC hardware supports a maximum of 115200 bit per second, as well as half that (57600), one quarter (28800), 14400, 9600, 4800, etc. Thus 141250 is not available with standard hardware.
I made an interface a few years ago which used two Intersil 6502 UARTS, with different crystal oscillators for each and a little bit of glue logic components - receiving on one UART triggered transmission on the other, so this converted between different baud rates. No buffering or anything, so you had to "go slow".
Try posting on the hardware forum - maybe some of the USB-to-serial adapters allow strange rates like you need.
|
|
|
|
|
Hi,
I have a few dialogs, icons, bitmaps, strings that I've localized in the
following way:
I've created a separate resource only dll which has a separate RC file for
each language.
This project also has a different build configuration for each language.
So that in that configuration only that dll will build and the resources
pane in the project properties will be set to the proper culture for each
build configuration.
I am loading that dll from a COM c++ dll in the following way:
m_hDll = ::LoadLibraryEx(filename.c_str(),NULL,LOAD_LIBRARY_AS_DATAFILE);
ATLASSERT(m_hDll != NULL);
ATL::_AtlBaseModule.SetResourceInstance(m_hDll);
AfxSetResourceHandle(m_hDll);
It loads successfully and loads the correct file.
For all the languages, but german, everything else also works good.
Issue #1
For german, DoModal throws an access violation.
Debugging MFC shows that this line throws the exception :
hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate,
pParentWnd->GetSafeHwnd(), AfxDlgProc);
hInst, lpDialogTemplate, AfxDlgProc are all fine and valid adresses.
m_hWnd of the pParentWnd is not :
m_hWnd CXX0030: Error: expression cannot be evaluated
At first I was getting an assertion failure in the MFC code, in
COccManager::CreateDlgControls, on the following lines :
if(pOccDlgInfo->m_pItemInfo[i].nId)
{
COleControlSiteOrWnd *pTemp = new COleControlSiteOrWnd(::GetDlgItem
(pWndParent->GetSafeHwnd(), pOccDlgInfo->m_pItemInfo[i].nId),
pOccDlgInfo->m_pItemInfo[i].bAutoRadioButton);
ASSERT(pTemp->m_hWnd);
}
After a couple of reruns it became an access violation.
The interesting part is that if I switch to a non german regional setting
and load the german resources file, it works.
Once the regional settings are set to german loading any language resource
file produces the same failure on DoModal.
I've compared the build configuration settings and the rc file to the other
languages and their rc and definitions.
It's all the same besides the language setting parts...
Any ideas ?
What to look for ?
Can it be a problem with the german language pack installtion ???
Issue #2
The other problem is for all the languages :
One of the ctrls of the dialog is an ATL Composite Ctrl which comes from
another project. It is supposed to show the text TEXT.
What happens is that my dialog shows the language extension, according to
the culture in my regional settings, right before that text:
<fr>TEXT
or
<ru>TEXT
Where does that come from ? How do I get rid of that ?
--
Thank you!
|
|
|
|
|
I want to react upon the ESC key during a loop is processed to give the user a chance to abort the current operation which might take some time. Since the processing of the loop takes most of the cpu capacity, message processing seems to be delayed until the loop is finished. Any idea how to solve this?
|
|
|
|
|
Either peek for messages periodically during your processing, or put processing into a separate thread, but you still have to check against an 'aborted' flag periodically - which would be set by the UI thread which received the ESC key.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
|
Man that is cool!
Regards,
Rajesh R. Subramanian
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
why dont u make the "lengthy operation" as a seperate thread?....i think that should sove the prob!
cheerz!
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|