|
Hi ya all!
The following code i supposed to create a window inside another window.
m_Page.CreateEx(WS_EX_LEFT | WS_EX_TOPMOST,
AfxRegisterWndClass(CS_CLASSDC),
_T(""), WS_VISIBLE | WS_CHILD, rcClient.left, rcClient.top,
rcClient.Width(), rcClient.Height(), m_hWnd, NULL);
The window is created at program start (I'm able to paint in it), but at close I get;
"Unhandled exception at 0x77f7f570 in kalender.exe: User breakpoint."
Which point to;
"77F7F570 int 3" in Disassembly
If the mousepointer is in this window at program start it show a hourglass, until the pointer is moved outside this window.
Thankfull for all your help
/DrZOO
___________________
Chics are for fags!
|
|
|
|
|
Hi There.
I have a very easy question Do there exists any API function or so, in MFC/Windows that can return with a language string, if it receives a language ID? For instance:
LanguageID2String(0x09) will then return "English"
I know that there must be a function like this, but I can't find it. Can you help me?
Thanks in advance,
Best Regards
Søren Madsen
Denmark
|
|
|
|
|
IMultiLanguage *pML;
HRESULT hr = CoCreateInstance(CLSID_CMultiLanguage, NULL, CLSCTX_ALL, IID_IMultiLanguage, (void**) &pML);
hr = pML->GetRfc1766Info(0x09, &info);
You may enumerate all locales with:
IMultiLanguage *pML;
HRESULT hr = CoCreateInstance(CLSID_CMultiLanguage, NULL, CLSCTX_ALL, IID_IMultiLanguage, (void**) &pML);
IEnumRfc1766 *pEnumerator;
hr = pML->EnumRfc1766(&pEnumerator);
RFC1766INFO info;
ULONG nRet;
while (SUCCEEDED(hr))
{
hr = pEnumerator->Next(1, &info, &nRet);
if (SUCCEEDED(hr))
{
CString str(info.wszLocaleName);
TRACE(str + "\n");
}
}
Hope that helps.
|
|
|
|
|
If you have IE 5.5 or later, you may use HRESULT LcidToRfc1766(LCID locale, LPTSTR pszRfc1766, int nChar); The previously posted example should work with IE 4.0 according to MSDN.
|
|
|
|
|
Hi Niklas
Thank you very much for your help, and example. I really looks nice, and I am sure that it will help my further in the project.
Best Regards
Søren Madsen
Denmark
|
|
|
|
|
There are always simpler ways to do things Either one of
::GetLocaleInfo(0x09, LOCALE_SENGLANGUAGE, szBuf, 256);
::GetLocaleInfo(0x09, LOCALE_SLANGUAGE, szBuf, 256); will do, depending on what info you need. I've had this thing on my mind all day, so I had to investigate it further. I knew there must be something for this in the windows API. Well, it wasn't harder than this
|
|
|
|
|
When trying to use my ActiveX control in Visual C++, I noticed that when inserting the control in the dialog the control will not be created which causes the m_hWnd to be NULL which causes problems in my control behavior at design time. What shall I do to overcome this problem? Any ideas?
Daed
|
|
|
|
|
Hi,
Can somebody give me code for VC++ and linux (C) where
my linux module recv a file and VC++ module sends a file.
I've developed it but the problem is that if i transfer
JPG files.. the files are getting distorted..
Any hints and snipplets would be a great help
Thanx
|
|
|
|
|
I´m having problems getting the my process handle, using GetCurrentProcess() I always
get 0xfffffff... back. I need to get my own process handle to pass on to a watchdog process to monitor, has anyone any idea how to get to grips with this problem ?
ps, I´m using ATL/WTL and API NO MFC
|
|
|
|
|
The return value is a pseudo handle , to get the real handle use GetCurrentProcess() with DuplicateHandle() or call to OpenProcess()
|
|
|
|
|
Thanks, I used the following code
HANDLE hHandle;
DuplicateHandle(GetCurrentProcess(), GetCurrentProcess(), GetCurrentProcess(), &hHandle, PROCESS_ALL_ACCESS | STANDARD_RIGHTS_REQUIRED |THREAD_ALL_ACCESS, FALSE,NULL);
CloseHandle(hHandle);
That worked...
|
|
|
|
|
The 0xff thing is correct as in the doc however u may want to use the PID instead i.e. GetCurrentProcessId()
Until the process terminates, the process identifier uniquely identifies the process throughout the system
|
|
|
|
|
That´s true, but as far as I Know (read) you can not terminate or kill a process with the PricossID, just with the Process handle.
But any way, I ´ve solved that problem, know I have to change the Token on NT/XP/2000 system to Terminate/Kill the process, and Shutdown or reboot, and the MSDN is not very helpfull at all
|
|
|
|
|
I have a program (like a virtual keypad) which I wpould like to inject typed things into another process. What I have works if the program that gets it is the main window (like notepad etc). However, if I want to send things to a control like edit box INSIDE the window, I know that the window gets the message but the edit box does not.
This is due to the fact I get the HWND to the window of the target windo as
HWND wnd =::GetForegroundWindow()
Thus I tried to do this:
CWnd* pWnd = FromHandle(wnd);
CWnd* pFoc = pWnd->GetFocus();
I then use pFoc->m_hWnd in the AttachTHreadINput call
What is wrong here. I get some can not read from loc ??? error. What would I need to do to get the HWND to the actual control inside the window that has the focus FROM another program?
THanks for any advise.
|
|
|
|
|
Before I setup the Printer Setup dialog I wanted to set the paper size and orientation ect.
What I did was:
CPrintDialog PDlg(TRUE);
GlobalAlloc(GMEM_MEVABLE, sizeof(DEVMODE));
DEVMODE* pDevMode = (DEVMODE*) GlobalLock(PDlg.m_pd.hDevMode);
pDevMode-> ...
...
GlobalUnlock(PDlg.m_pd.hDevMode);
PDlg.DoModal();
According to MSDN this should be enough to initialize things before the call to DoModal, right?
Thanks for any suggestions.
|
|
|
|
|
I'm interested to know what version control ppl use at work. I'm currently evaluating visual sourcesafe with sourceoffsite for distributed team collaboration on code and also cvs on a linux machine with windows gui clients. One is free and the other is not but has anyone had any experiences with both or use something else?
|
|
|
|
|
We use SourceSafe and SourceOffsite here. biut I'm afraid I've got no experience of CVS.
This topic has been discussed pretty extensively in the Lounge, so I'd suggest a quick trail through the posts (don't worry, there's only 77,000 of them ) would be a good starting point.
Just try setting the filter to "SourceSafe" or "version control" and you'll find plenty of information.
Andy Metcalfe - Sonardyne International Ltd
Trouble with resource IDs? Try the Resource ID Organiser Add-In for Visual C++
"I would be careful in separating your wierdness, a good quirky weirdness, from the disturbed wierdness of people who take pleasure from PVC sheep with fruit repositories."
- Paul Watson
|
|
|
|
|
We have used WinCVS at work and found that on many occations it 'Lied' to us about diffs in files.
We also us Source Safe on projects where we use Visual Studio as it is conviently intergrated. A warning however if the SS database is on a UNIX server, be sure that the file system which contains the 'sepository' is not subject to quotas. If a user overruns the soft quota during the checkin process, it screws up the repository because the file will be integrated and the history update may not happen. This happened a number of times on a previous project I worked on and now I have insisted that source code is free of quotas, because we know that no matter which system you use the repository will only grow and not shrink.
Happy programming!!
|
|
|
|
|
I have imported office 97 (or maybe XP), no dll hell any more, now it is called com hell;
#import "D:\Microsoft Office.97\Office\Mso97.dll"
#import "c:\Program files\Common Files\Microsoft Shared\VBA\VBE.DLL"
#import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBEEXT1.OLB"
#import "D:\Microsoft Office.97\Office\MSWORD8.OLB"
As i would like to support different office versions, i need "a bit" changed headers, so there wouldnt be any namespace conflict between different versions of imported librarys.
After checking tlh, i have encountered on #pragma start_map_region. What does it do?
|
|
|
|
|
The only thing I can think of is that start_map_region is a macro. Try searching for a definition...
Otherwise I'm afraid I can't help.
/moliate
|
|
|
|
|
How can i get the 16 byte MAC address (card address)
programatically..
Its not the IP.. the other one
Sameer
|
|
|
|
|
BOOL CRegistrationSerial::GetMAC(int adapter_num, char *pMacAddress)
{
struct STASTAT
{
ADAPTER_STATUS adapt;
NAME_BUFFER NameBuff[30];
};
// Reset the LAN adapter so that we can begin querying it
NCB Ncb;
memset(&Ncb, 0, sizeof(Ncb));
Ncb.ncb_command = NCBRESET;
Ncb.ncb_lana_num = adapter_num;
if (Netbios(&Ncb) != NRC_GOODRET)
return false;
// Prepare to get the adapter status block
ZeroMemory(&Ncb,sizeof(Ncb));
Ncb.ncb_command = NCBASTAT;
Ncb.ncb_lana_num = adapter_num;
strcpy((char *) Ncb.ncb_callname, "*");
STASTAT stAdapter;
ZeroMemory(&stAdapter,sizeof(STASTAT));
Ncb.ncb_buffer = (unsigned char *)&stAdapter;
Ncb.ncb_length = sizeof(stAdapter);
// Get the adapter's info and, if this works, return it in standard,
// colon-delimited form.
if (Netbios(&Ncb) == 0)
{
sprintf(pMacAddress, "%02X:%02X:%02X:%02X:%02X:%02X",
int (stAdapter.adapt.adapter_address[0]),
int (stAdapter.adapt.adapter_address[1]),
int (stAdapter.adapt.adapter_address[2]),
int (stAdapter.adapt.adapter_address[3]),
int (stAdapter.adapt.adapter_address[4]),
int (stAdapter.adapt.adapter_address[5]));
return true;
}
return false;
}
|
|
|
|
|
I write the following code to draw a radial gradient fill,but it goes to slowly.Can anyone help to correct the code,please?
/////////////////////////////////////////////////////////////////////////////////////////////// Function Header
void PaintEllipse(CDC* pDC, int x, int y, int w, int h, COLORREF color)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
{
CRect rc = CRect(x,y,x+w,y+h);
CBrush brush(color);
CBrush* pOldBrush = pDC->SelectObject(&brush);
pDC->Ellipse(&rc);
pDC->SelectObject(pOldBrush);
}
void FillRadialGradient (CDC *pDC,CRect rect, COLORREF crStart, COLORREF crEnd)
{
CPen *pOldPen;
pOldPen = NULL;
PaintRect(pDC,rect.TopLeft().x,rect.TopLeft().y,rect.Width(),rect.Height(),crStart);
pOldPen = (CPen *)pDC->SelectStockObject(NULL_PEN);
CRect rcBound = rect;
int nTotal = max(rcBound.Width(),rcBound.Height());
double rStep,gStep,bStep,rVal,gVal,bVal;
COLORREF colorA=crStart,colorB=crEnd;
rVal=(double)GetRValue(colorA);
gVal=(double)GetGValue(colorA);
bVal=(double)GetBValue(colorA);
rStep=((double)GetRValue(colorB)-rVal)/nTotal;
gStep=((double)GetGValue(colorB)-gVal)/nTotal;
bStep=((double)GetBValue(colorB)-bVal)/nTotal;
double dX = max(fabs(rStep), max(fabs(gStep), fabs(bStep)));
if( dX < 1.0 / ((double)nTotal) )
dX = (double)nTotal;
else
dX = max(1.0, floor(1.0/dX));
int delY = 3 * (int)dX;
delY = max(delY, 3); // make sure it is not less than 2
if(nTotal < 70)
{
delY = 1;
}
int nSteps = nTotal/delY;
for (int i = 0; i < nSteps; i++)
{
// do a little alpha blending
BYTE bR = (BYTE) rVal;
BYTE bG = (BYTE) gVal;
BYTE bB = (BYTE) bVal;
CRect r2 = rect;
r2.DeflateRect(i * rect.Width() /(2 * nSteps),i * rect.Height() / (2 * nSteps),i * rect.Width() / (2 * nSteps),i * rect.Height() / (2 * nSteps));
PaintEllipse(pDC,r2.left,r2.top,r2.Width(),r2.Height(),RGB(bR, bG, bB));
rVal+=(rStep * delY);
gVal+=(gStep * delY);
bVal+=(bStep * delY);
}
if(pOldPen != NULL)
{
pDC->SelectObject(pOldPen);
}
}
Please!!!!!!!!
|
|
|
|
|
pDC->Ellipse(&rc); is consuming over 70% of the time spent in your two functions (using a rectangle with size 200 by 200 and a memory DC)
You are painting the same areas over and over again, excluding the outermost part of the ellipse.
|
|
|
|
|
Many thanks your reply,but how can I solute these problems.I have tried many methods.
Many thanks again!
|
|
|
|
|