|
Hello, the codegurus around the world.;)
The other way is to add the followings.
#include shlwapi.h
#pragma comment( lib, "shlwapi" )
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
I want to write a actviex control using Directx8 to draw something on it. so I use ATL to builld a full control project, and then select the window only option. Though I get a valid HWND(m_hWnd), I couldn't use this to initialize the D3D device, I always get a NULL LPDIRECT3DDEVICE8
------------------------
yupl@163.net
yupl@eyou.com
PHD YLLY
|
|
|
|
|
Hey ppl
I heard that there was a macro I could use in VC++ that would allow me to use dialog's etc... from a inside a DLL (ie. use in a plugin)
Regards
|
|
|
|
|
I'm using a CAxWindow to host a web browser in a shell namespace. To handle keys like backspace, delete, tab and not pass them on to windows explorer I use the following code to call the IOleInplaceActiveObject->TranslateAccelerators and then return S_OK so explorer does not process the keys as well. This works fine in Windows 2000 but on NT4 it returns a HRESULT
value of 1 (Incorrect Function). I can even call other IOleInplaceActiveObject methods without a problem but not TranslateAccelerators! Microsoft documentation just states that one should use basically the same code as below.
What does 'incorrect function' usually mean? Is this method not implemented?
ContainerWindow is declared as a CAxWindow
STDMETHODIMP CShellView::TranslateAccelerator(LPMSG pMsg)
{
if ((pMsg->message >= WM_KEYFIRST) && (pMsg->message <= WM_KEYLAST))
{
// Activate the control in the container
CComQIPtr<ioleobject, &iid_ioleobject=""> spOleObject;
ContainerWindow.QueryControl(IID_IOleObject, (LPVOID*)&spOleObject);
if (spOleObject)
{
RECT rect;
GetClientRect(hwndContainer, &rect);
spOleObject->DoVerb(OLEIVERB_UIACTIVATE, NULL, (IOleClientSite*)this, 0, hwndContainer, &rect);
}
}
if ( ((pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP) &&
(pMsg->wParam == VK_TAB || pMsg->wParam == VK_DELETE || pMsg->wParam == VK_BACK)))
{
CComQIPtr<ioleinplaceactiveobject, &iid_ioleinplaceactiveobject=""> spInPlaceActiveObject;
ContainerWindow.QueryControl(IID_IOleInPlaceActiveObject, (LPVOID*)&spInPlaceActiveObject);
if (spInPlaceActiveObject)
{
HRESULT hr;
//*******************************************************
// This returns "Incorrect Function" on NT
hr = spInPlaceActiveObject->TranslateAccelerator(pMsg);
return hr;
}
}
return S_FALSE;
}
|
|
|
|
|
Hello,
Anyone know how I can set the read-only attribute on a directory?
I tried ::SetFileAttribute(...); but it doesnt seem to work.
Also, if someone know how I can safedel files (delete them to the trashcan) I would be happy if you told me ...
Cheers,
Henrik
|
|
|
|
|
<<< In the name of GOD >>>
Hi.
If anyone have any notice about using of ActiveX, please write for me.
Thanks.
Hadi Rezaie
|
|
|
|
|
Hi: I have written the follow instruction in VC++ to execute a program in Unix machine:
system("rsh dirIP -l root -n sh path\name parameters -l")
but it open a cmd windows. What can I do to not to show this windows? Thanks
|
|
|
|
|
Hi,
I'm not sure, but i think you must use CreateProcess function, for running the file.
Hadi Rezaie
|
|
|
|
|
Hi
I think You can use pipe line like it [>nul].
Thanks a lot.
|
|
|
|
|
Hello, the codegurus around the world.;)
I'm curious why you use VC++ compiler to write the program in Unix box.
Unix has its own compiler like cc or gcc.
Or you don't know how to use vi editor or EMacs editor?
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Why assume that someone doesn't *know* about other compilers ? Maybe they prefer VC++ ??
|
|
|
|
|
I prefer don´t tell you why I need it but I`m sure that it is that I need. I know vi perfectly, so I`m sorry but you are confuse cause I don´t need VC++ to write a program in Unix, a piece of program is in Unix and the rest is in VC++. Are you O.K.?
|
|
|
|
|
Hi.
I have a dll that exports a few functions. I called the same function in two threads which is running concurrently in the same process. Does it interfere with each other? Especially the variables defined in the function?
Thanks
Agus
|
|
|
|
|
if you didn't use static or global variable then you ok.
good luck,
Dror
|
|
|
|
|
Whether your code is thread-safe depends entirely on how you wrote it. Stack variables will not cause a problem, since each thread has its own stack. Any static or global variables in the DLL can be access from multiple threads, however, so you should protect access to them with critical sections.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
<<< In the name of GOD >>>
Hi.
My program is in SDI mode, and also i use of CFormView(Form-Based program).
I have Editbox in my document, i want to get data from Editbox, wihout CSDIFormView.
It mean when i have focus in other dialog ....
It's my source code:
// SOURCE IN DIALOG ...
#include "sdiformview.h"
.
.
.
void CMyDialog::Button()
{
CSDIFormView *pV;
CString szText = pV->m_Edit;
AfxMessageBox(szText);
}
Please help me ...
Hadi Rezaie
|
|
|
|
|
Hello, the codegurus around the world.;)
There are a couple of ways to do your wish.
One is to use static function to get CWnd of FormView.
In MSDN help, you will find the followings.
HOWTO: Get Current CDocument or CView from Anywhere
Last reviewed: July 31, 1997
Article ID: Q108587
In detail,
For SDI application,
CMyView * CMyView::GetView()
{
CFrameWnd * pFrame = (CFrameWnd *)(AfxGetApp()->m_pMainWnd);
CView * pView = pFrame->GetActiveView();
if ( !pView )
return NULL;
if ( ! pView->IsKindOf( RUNTIME_CLASS(CMyView) ) )
return NULL;
return (CMyView *) pView;
}
For an MDI application, the CMyView::GetView() code should be the following:
CMyView * CMyView::GetView()
{
CMDIChildWnd * pChild =
((CMDIFrameWnd*)(AfxGetApp()->m_pMainWnd))->MDIGetActive();
if ( !pChild )
return NULL;
CView * pView = pChild->GetActiveView();
if ( !pView )
return NULL;
if ( ! pView->IsKindOf( RUNTIME_CLASS(CMyView) ) )
return NULL;
return (CMyView *) pView;
}
Now, from anywhere in your program, where the document or view header files have been included, you can call:
CMyView::GetView();
After you get CWnd of FormView, you can access CWnd of Edit control on CYourFormView.
You had better change from CMyView to CMyFormView.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Hi Masaaki, and thanks a looot for reply.
But i couldn't write this program, because i'm begginer.
If possible, write small example about it, and send to me, Please please please ...
Hadi Rezaie
|
|
|
|
|
Hello all,
I've recently made a source-code navigater (Explorer look-alike, MFC application), on which one can doubleclick on a file. For source-code files, these files will then be opened in Microsoft Developer Studio (version 6).
My problem
----------
Sometimes the view of MSDEV is corrupted by contents of my MFC-application. When minimize and maximize MS-DEV, the view is correct again.
So actually I need to refresh the MSDEV environment, after opening a file from external application (my application).
Question
--------
How can I make MSDEV refreshing the view from an other application?
Many thanks,
EiSl
|
|
|
|
|
Hi,
I want to sort items in a CListCtrl. However, the sorting is not according to the first column. For example, when the user clicks on another column in the header, the list should be sorted according to that column.
I tried many methods, but I wasnt successful. I am waiting for your helps.
Thank you for any helps in advance
regards
Mustafa Demirhan
|
|
|
|
|
I don't know of an 'in list' solution - I do it by keeping the data in a structured array, then grab the button that has been clicked over and sorting the array by that 'colomn' values, then empty and reinsert. I remember using flexgrid once and it did it a whole lot easier, but was it's own world of grief in other areas...
|
|
|
|
|
Do a search on this forum for:
Sorting data in CListCtrl columns
I asked the same question. Let me know when you are done with the sorting implementation.
Ammar
|
|
|
|
|
Thanks a lot. I have solved the problem.
|
|
|
|
|
I try to create and show a bitmap based on one short array.No error occours during compile,but the bitmap just don't show on the view.
My code as follow:
void CReadfile1View::DrawDIBSection(HDC hDC , int xDest,int yDest,int w, int h,signed short*image)
{
BITMAPINFOHEADER *bih=0;
// HDC hDC=0;
HBITMAP hbm;
void *bits;
try
{ // allocate room for BITMAPINFOHEADER and color mask's
if(!(bih = (BITMAPINFOHEADER*)malloc(sizeof(BITMAPINFOHEADER))))
throw 0;
ZeroMemory(bih,sizeof(BITMAPINFOHEADER));
bih->biSize = sizeof(BITMAPINFOHEADER);
bih->biWidth = w; // .
bih->biHeight = h; // match array-size
bih->biPlanes = 1;
bih->biBitCount = 16;
bih->biCompression = BI_RGB; // we use 5:5:5 format
bih->biSizeImage = bih->biWidth * 2 * bih->biHeight;
if(!(hDC = ::GetDC(0))) throw 0; // create the 16-bit DIBSECTION
if(!(hbm = ::CreateDIBSection(hDC,(BITMAPINFO*)bih,DIB_RGB_COLORS,&bits,0,0))) //
throw 0; // get the array into the DIBSECTION
if(::SetDIBits(hDC,hbm,0,h,image,(BITMAPINFO*)bih, DIB_RGB_COLORS) != h)
throw 0;
}
catch(...)
{
// cout<<"unknown type of exception throw"<<'\n';
}
HDC hDCMem=::CreateCompatibleDC(hDC);
HGDIOBJ hBmpOld=::SelectObject(hDCMem,hbm);
BitBlt(hDC,xDest,yDest,bih->biWidth,bih->biHeight,hDCMem,0,0,SRCCOPY);
::SelectObject(hDCMem, hBmpOld);
::DeleteDC(hDCMem);
if(hDC) ::ReleaseDC(0,hDC);
if(bih) free(bih);
}
void CReadfile1View::OnDraw(CDC* pDC)
{
CReadfile1Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
DrawDIBSection(*pDC,10,10,WIDTH,HEIGHT,pDoc->Image[0]);
}
Who can tell me why it don't works and how to improve?!
thanx!
fly against the wind
|
|
|
|
|
Hi,
I didn't have much time to check your code completely, but I think the source line:
if(!(hDC = ::GetDC(0))) throw 0; // create the 16-bit DIBSECTION
is incorrect.
You re-initialize the local parameter hDC, which was sent by the call to your DrawDIBSection(..) function in the OnDraw method. It will be set to a DC for the desktop, by ::GetDC(0).
This hDC is used for the BitBlt(..) command later.
Not a sollution, but just a hint...
Istvan Eperjesy
|
|
|
|
|