|
Actually you should use a frame. A text box will conceal the controls contained within its rectangle.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Yes, I found that out after I ran it. I think a group box might be what I was looking for...
Txs
B.
|
|
|
|
|
ive new to win 32 programming and ive a simple image processing win 32 application that is giving errors, when i load my image it works fine but if i open another application over it the image on the screen dissapears??? any ideas????
|
|
|
|
|
Windows is sending you a WM_PAINT message when the other application is moved out of the way. You're probably not processing this message. You'll have to get used to the event-driven nature of windows applications.
My suspicion is that you load the image and render it within the same code pathway. What you may want to do, in the interim, is move the code that draws the image into its own function. Then, instead of calling that imaging function after you load it, just make a call to InvalidateRect(<your window's handle>, NULL, FALSE); . This will cause a WM_PAINT message to be generated for your window.
Then add a handler for the WM_PAINT message. In this handler, call your image rendering function. This way, you cover all of the cases where your window may need redrawing.
Bob Ciora
|
|
|
|
|
Hi,
It is possible to work with objects created on the stack ( Cat Tom; ) or on the free store ( Cat *pTom = new Cat; ). Is there a general rule when I use what?
Thanks,
Martin
|
|
|
|
|
As a rule of thumb, create objects on stack when you can. It is simpler, safer (no memory leaks and dangling pointers) and results in faster code (stack allocation is way faster than heap allocation).
There are cases though, when you must create objects on heap: i.e. if you don't know the number of objects at compile time, or if you want to use run-time polymorphism.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Ah, I see...
Thanks a lot,
Martin
|
|
|
|
|
i'd created form with elements (StaticText, EditText and so on).
how can I add it to toolbar?
Regards
|
|
|
|
|
Hello
I get this error when I build my project in the RELEASE mode,However, when i build it in the DEBUG moe then I dont get these errors and the project runs properly.
Can someone help me remove these errors please.
NewMumsEngine error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall bad_cast::bad_cast(char const *)" (__imp_??0bad_cast@@QAE@PBD@Z)
NewMumsEngine error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)
NewMumsEngine error LNK2001: unresolved external symbol "public: __thiscall bad_cast::bad_cast(class bad_cast const &)" (??0bad_cast@@QAE@ABV0@@Z)
NewMumsEngine error LNK2001: unresolved external symbol "public: virtual __thiscall bad_cast::~bad_cast(void)" (??1bad_cast@@UAE@XZ)
NewMumsEngine error LNK2001: unresolved external symbol @__security_check_cookie@4
NewMumsEngine error LNK2001: unresolved external symbol ___CxxFrameHandler
NewMumsEngine error LNK2001: unresolved external symbol ___security_cookie
NewMumsEngine error LNK2001: unresolved external symbol __imp__stricmp
Thanks,
Arjun
Arjun Mukherjee
Software Engineer
Hewlett Packard
|
|
|
|
|
Check your Project Settings. Chances are, you've specified an external library in "Win32 Debug" mode in the "Object/Library Modules" line under the Link tab in your Settings. If you check "Win32 Release" settings, the library is probably not listed. Whatever libraries you've manually added for "Win32 Debug" settings have to also be specified in "Win32 Release."
Bob Ciora
|
|
|
|
|
Hello
I get this error when I build my project in the RELEASE mode,However, when i build it in the DEBUG moe then I dont get these errors and the project runs properly.
Can someone help me remove these errors please.
NewMumsEngine error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall bad_cast::bad_cast(char const *)" (__imp_??0bad_cast@@QAE@PBD@Z)
NewMumsEngine error LNK2001: unresolved external symbol "const type_info::`vftable'" (??_7type_info@@6B@)
NewMumsEngine error LNK2001: unresolved external symbol "public: __thiscall bad_cast::bad_cast(class bad_cast const &)" (??0bad_cast@@QAE@ABV0@@Z)
NewMumsEngine error LNK2001: unresolved external symbol "public: virtual __thiscall bad_cast::~bad_cast(void)" (??1bad_cast@@UAE@XZ)
NewMumsEngine error LNK2001: unresolved external symbol @__security_check_cookie@4
NewMumsEngine error LNK2001: unresolved external symbol ___CxxFrameHandler
NewMumsEngine error LNK2001: unresolved external symbol ___security_cookie
NewMumsEngine error LNK2001: unresolved external symbol __imp__stricmp
Thanks,
Arjun
Arjun Mukherjee
Software Engineer
Hewlett Packard
|
|
|
|
|
Perhaps the .lib you're linking against is only specified for debug builds?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Any good samples (C++/C) for LDAP that is compatible to Win9x and NT based (2000 and XP inclusive)
Anyone using Mozilla LDAP C SDK? (too bad it is only compatible to NT based windows)
thanks.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Have you tried using ADSI?
You should be able to use it with 9x platforms. See Active Directory Service Interfaces[^]
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Does ASDI require Ms Exchange? I need something that only have dependencies to Windows(9x, NT) and no more.
thanks.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
I have a CScrollView (my private class is U_W_SCROLL_VIEW) and try to draw it invisible to the screen and export the drawn picture into an enhanced metafile.
The drawing is not right and I am getting various error or assertion failures in debug mode.
Can anyone point me to anything that I might be missing or doing wrong??
Any help welcome.
Here is the code
AB_BOOL<br />
U_W_SCROLL_VIEW::handle_metafile_save(const AB_Text& filename)<br />
{<br />
AB_Integer handler;<br />
MetaNode * pMetaNode;<br />
CMetaFileDC * pDCMetaFile;<br />
DWORD dwError;<br />
<br />
CMDIChildWnd* pChildFrame = (CMDIChildWnd*)GetParent();<br />
pChildFrame->ShowWindow(SW_HIDE);<br />
<br />
if( ::GetLastError() )<br />
::SetLastError(0);<br />
<br />
OnInitialUpdate();<br />
<br />
if( dwError = ::GetLastError() )<br />
goto failed;<br />
<br />
handler = request_create_metafile();<br />
<br />
pMetaNode = (MetaNode*)handler.to_long();<br />
pDCMetaFile = pMetaNode->pDCMetafile;<br />
<br />
set_export_metafile(handler, filename);<br />
<br />
OnPrepareDC(pDCMetaFile, NULL);<br />
if( dwError = ::GetLastError() )<br />
goto failed;<br />
<br />
OnDrawn(pDCMetafile);<br />
<br />
.........................<br />
}<br />
<br />
void<br />
U_W_SCROLL_VIEW::OnInitialUpdate()<br />
{<br />
TEXTMETRIC tm;<br />
CRect clientRect;<br />
CClientDC dc(this);<br />
<br />
m_hDC = dc.GetSafeHdc();<br />
<br />
if( abstract_logic->isExporting() ) {<br />
dc.SetWindowOrg(0, 0);<br />
}<br />
<br />
CFont* pOldFont = dc.SelectObject(&m_font);<br />
dc.GetOutputTextMetrics(&tm);<br />
m_sizeLine.cx = tm.tmAveCharWidth;<br />
m_sizeLine.cy = tm.tmHeight + tm.tmExternalLeading;<br />
dc.SelectObject(pOldFont);<br />
<br />
GetClientRect(clientRect);<br />
m_sizePage.cx = clientRect.Width();<br />
m_sizePage.cy = clientRect.Height();<br />
<br />
int rem_x = m_sizePage.cx % m_sizeLine.cx;<br />
int rem_y = m_sizePage.cy % m_sizeLine.cy;<br />
<br />
m_sizePage.cx -= rem_x;<br />
m_sizePage.cy -= rem_y;<br />
<br />
::SetClassLong( this->m_hWnd, GCL_HCURSOR, NULL );<br />
<br />
m_hDefaultCursor = ::LoadCursor( NULL, IDC_ARROW );<br />
m_hCursor = m_hDefaultCursor;<br />
::SetCursor(m_hCursor);<br />
<br />
SetScrollSizes( MM_TEXT, m_sizeScroll, m_sizePage, m_sizeLine );<br />
}<br />
<br />
void<br />
U_W_SCROLL_VIEW::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo)<br />
{<br />
<br />
HDC hAttribDC = this->m_hDC;<br />
<br />
metafiles.RemoveAll();<br />
<br />
m_hDC = pDC->GetSafeHdc();<br />
<br />
abstract_logic->handle_draw_persistent();<br />
<br />
AB_Integer left, top, right, bottom;<br />
<br />
abstract_logic->get_view_total_size(left, top, right, bottom);<br />
<br />
if( !request_begin_export_metafile(left, top, right, bottom) )<br />
return;<br />
<br />
m_hDC = pDC->GetSafeHdc();<br />
<br />
pDC->SetAttribDC(hAttribDC);<br />
<br />
<big> <br />
CScrollView::OnPrepareDC(pDC, pInfo);<br />
<br />
</big> pDC->SetMapMode(MM_TEXT);<br />
}<br />
<br />
<br />
AB_BOOL<br />
U_W_SCROLL_VIEW::request_begin_export_metafile(<br />
AB_Integer& left,<br />
AB_Integer& top,<br />
AB_Integer& right,<br />
AB_Integer& bottom )<br />
{<br />
MetaNode * pMetaNode = (MetaNode*) m_hExporting.to_long();<br />
CMetaFileDC * pDCMetaFile = pMetaNode->pDCMetafile;<br />
<br />
CDC * pDC = GetDC();<br />
<br />
int factor_x = ceil( (pDC->GetDeviceCaps(HORZSIZE) * 100.0)/ pDC->GetDeviceCaps(HORZRES));<br />
int factor_y = ceil( (pDC->GetDeviceCaps(VERTSIZE) * 100.0)/ pDC->GetDeviceCaps(VERTRES));<br />
<br />
CRect rect( 0, 0, (right.to_long() - left.to_long() + 10) * factor_x,<br />
(bottom.to_long()- top.to_long() + 10) * factor_y );<br />
<br />
if (!pDCMetaFile ->CreateEnhanced(pDC, m_psExporting->data(), &rect, NULL))<br />
{<br />
::SetLastError(-1);<br />
<br />
return AB_FALSE;<br />
}<br />
<br />
HDC hDC = pDCMetaFile->GetSafeHdc();<br />
<br />
SetGraphicsMode(hDC, GM_ADVANCED);<br />
pMetaNode->bounds.left = left.to_long();<br />
pMetaNode->bounds.right = right.to_long() + 10;<br />
pMetaNode->bounds.top = top.to_long();<br />
pMetaNode->bounds.bottom = bottom.to_long() + 10;<br />
<br />
return AB_TRUE;<br />
}<br />
<br />
void<br />
U_W_SCROLL_VIEW::OnDraw(CDC* pDC)<br />
{<br />
XFORM xForm;<br />
RECT inv_rect;<br />
MetaNode* meta_node;<br />
POSITION pos;<br />
<br />
if( m_bInRepaint )<br />
return;<br />
<br />
m_bInRepaint = TRUE;<br />
m_hDC = pDC->GetSafeHdc();<br />
<br />
m_bPrinting = FALSE;<br />
AB_Integer left, top, right, bottom;<br />
<br />
request_get_metafile_bounds(m_hExporting, left, top, right, bottom);<br />
<br />
inv_rect.left = left.to_long();;<br />
inv_rect.top = top.to_long();<br />
inv_rect.right = right.to_long();<br />
inv_rect.bottom = bottom.to_long();<br />
COLORREF clr = ::GetSysColor(COLOR_WINDOW);<br />
<br />
<big>
pDC->FillSolidRect(&inv_rect, clr);<br />
</big><br />
SetGraphicsMode(m_hDC, GM_ADVANCED);<br />
<br />
ModifyWorldTransform( m_hDC, &xForm, MWT_IDENTITY );<br />
<br />
Scale(m_hDC);<br />
Translate(m_hDC);<br />
<br />
pos = metafiles.GetHeadPosition();<br />
while( pos != NULL )<br />
{<br />
meta_node = (MetaNode*)metafiles.GetNext(pos);<br />
::PlayEnhMetaFile(m_hDC,meta_node->hMetafile,&(meta_node->bounds));<br />
}<br />
<br />
RestoreIdentityDC(m_hDC);<br />
}<br />
|
|
|
|
|
Hi I am developing one small windows service runs on Windows 2000. It retrieves the mails from the mail box of the Microsoft Exchange User using MAPI function calls. When I am doing the same thing from my Win32 Console Application I am getting the mails from Inbox. But if i try to put that into Service, it shows it cannot obtain folder ?
Is it like MAPI call doesn't work in Service. ? What seems to be error ?
Regards
Mike
|
|
|
|
|
MAPI will require a mail client to be running in order for it to work correctly, otherwise a dialog asks for connection details. Since services run without the desktop, dialogs can not appear.
I would also check the access rights for the account that the service runs under.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Hi
I have a MFC Dialog window. I have created a modelless window which in turn creates another modelless window. The parent of all the modelless window is desktop.
Now the problem is that while pressing Alt+Tab I cannot see the Icon corresponding to the Main Dialog window (Model). But I can see the icon for all other windows(modelless, only if I set the parent to desktop).
All the windows have the same icon.(IDR_MAINFRAME)
What could be the problem?
Regards
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
My command line call might look like "sth.exe file1.txt file2.txt file3.txt".
How can i parse such a command line in an SDI application?
I've already tried ParseCommandLine(cmdInfo) and then cmdInfo.m_strFileName, but this only gives me the first parameter. How can i get the rest?
|
|
|
|
|
You can use
LPTSTR GetCommandLine(void);
to retrieves the command-line string for the current process.
And then pass the value obtained to
LPWSTR* CommandLineToArgvW(<br />
LPCWSTR lpCmdLine,<br />
int* pNumArgs<br />
);<br />
to convert the command line to an argv style array of strings.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
you can directly access _argc and _argv if you want to. Just include stdlib.h in the stdafx.h and there you go.
|
|
|
|
|
Hi
I have a process(root) which spawns other processes to get its work done. These children in turn may spawn more processes and so on. I want to obtain the memory used by all of these processes at a point of time from the root process(very 1st process).
So, I neeed 2 things:
First is to obtain all the process handles of this process tree.
So, Is there a way to find all the child processes for a particular process. Right now I am using "CreateToolhelp32Snapshot" to obtain a snapshot of all the processes in the system and then looking for the processes which have root process as their parent. Doing this recursively to obtain the whole process tree.
Is there a better approach available for doing this?
Secondly, get the memory used by process. Is there an API available to do this? Can not use "PSAPI" as its not for Win95, 98.
Thanx
kapil
|
|
|
|
|
See if EnumProcesses() or the Process32First() /Process32Next() pair help you.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Enumerate processes in a manner that obtains each process identifier. I am not sure how to detect they are part of same group or not.
To determine how much memory each one is using,
You can adjust each process token to add SE_DEBUG privilege.
Then OpenProcess to get handle from process identifier, then enumerate memory used by process using VirtulQueryEx.
|
|
|
|