|
Hi all
I have prepared an MMC..i have to set image for scope pane item and as well as same image for items shown in resultpane...so what functions shuld i use...
plzz help me its very urgent...
thax in advnace
|
|
|
|
|
Hi All
I have to add comboboxes in a listcontrol while initializing a dialog containing that list control.if anyone can expalin using some code ..how to perform this..this wud me very helpful to me....thanks to all in advance..
|
|
|
|
|
I have made a toolbar for a website and what i want is when the user login's in the website with a username and password i want to establish a database connection to MYSQL database and execute query for retrieving data.
Can anyone give me the code. I am USING WIN32 and NOT MFC.
Thanks in advance.
Dhiraj
Dhiraj Kumar Saini
|
|
|
|
|
I'd suggest you look at the appropriate MySQL documentation:
Those should tell you how to connect to a MySQL database.
|
|
|
|
|
thanks for the link you gave me for the tutorial.
I am able to connect to MYSQL database from my win32 application and also able to query the database.
Thanks for your help.
Dhiraj
Dhiraj Kumar Saini
|
|
|
|
|
hi
i am working with VS2003 and i got a problem with accessing to list member functions.
i have :
<br />
class company<br />
{<br />
public:<br />
CString comapany_name;<br />
int Number;<br />
list<worker> work;<br />
<br />
public:<br />
time_of_work(int ID);<br />
company(void);<br />
virtual ~company(void);<br />
}<br />
and
class worker
<br />
{<br />
public:<br />
CString name;<br />
int ID;<br />
int hours<br />
<br />
public:<br />
get_name(int ID);<br />
worker(void);<br />
virtual ~worker(void);<br />
}<br />
when i try to get the member function from the a company iterator that don't work:
<br />
list<company>::iterator comp;<br />
comp->..... it give me just a list of company methods and variables<br />
and if i try the dot('.')
<br />
comp. i can get {iterator, operator+,operator-,operator*,operator= }<br />
how can i get the list of the member functions ?
|
|
|
|
|
Your question isn't clear - for which class do you want a list of methods?
|
|
|
|
|
Can a Key in a map contain the combination of two variables?
Tough Time Never last, but Tough People do.
|
|
|
|
|
I think yes! through pair
|
|
|
|
|
Can you be more specific?
Steve
|
|
|
|
|
Key type could be a set of variables inside a structure or class.
valikac
|
|
|
|
|
I am able to find whether the webpage is a document object or not if it is then i want to retrieve the complete source code of the webpage and store it in a CString, Which interface to query and which function to use.
I want this thing to happen in BeforeNavigate2 of DWebBrowserEvents2.
Thanks in advance.
Dhiraj
Dhiraj Kumar Saini
|
|
|
|
|
Hi,
I want to create an IE plug-in where whenever a download dialog is expected, the file is downloaded automatically to a specified folder - the dialog should should not appear.
Has anyone worked on something similar? Is such a thing work be possible to do w/out extensive COM/IE/ATL/OLE knowledge?
I am somewhat familiar with C++ & COM/ATL/OLE concepts.
From the MSDN docs, I also know that I just need to create a COM object which implements a couple of interfaces and register it.
But, am absolutely clueless where to begin & how to get to that. (Never used the Visual Studio)
Any helpful pointers plz ?
Thanks,
-pk
|
|
|
|
|
|
You can use IMoniker for downloads files and IBindStatusCallback for accepts information on an asynchronous bind operation.
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
// CestDLHandler
CestDLHandler::CestDLHandler()
{
m_lUid = 0;
}
STDMETHODIMP CestDLHandler::Download(IMoniker* pmk,
IBindCtx* pbc,
DWORD dwBindVerb,
LONG grfBINDF,
BINDINFO* pBindInfo,
LPCOLESTR pszHeaders,
LPCOLESTR pszRedir,
UINT uiCP )
{
traceFerruccio(_T("IMoniker %p CestDLHandler %p \n"),pmk, this);
HRESULT hr;
//Stream will be released in the BSCB OnDataArrival
IStream *pstm;
//Attempt to create our BindStatusCallBack
WBBSCBFileDL *filedl = NULL;
//Returns a NonAddRef pointer to a new BSCB
//AddRef is called on this BSCB during a successfull call
//to RegisterBindStatusCallback
if(WBCreateBSCBFileDL(&filedl) != S_OK)
{
return E_FAIL;
}
//Init the BSCB
m_lUid++;
filedl->InitByUser(m_lUid, this, pszHeaders, NULL);
IBindStatusCallback *pPrevBSCB = NULL;
hr = RegisterBindStatusCallback(pbc,
reinterpret_cast<ibindstatuscallback*>(filedl), &pPrevBSCB, 0L);
/*
Exception to the rule
RegisterBindStatusCallback return E_FAIL
Cause: Content_Disposition header returned from a server
in response to a file download via a post or ,..
Example: downloading attachements from Hotmail, Yahoo, ...
Unfortunately, due to no documentation regarding an E_FAIL return,
and more specifically, regarding RegisterBindStatusCallback internal workings,
I had to resort to using RevokeObjectParam on the previous BSCB and in my
implementation of BSCB, relay certain calls to the previous BSCB to make DL work.
I do not know if this is a bug or done intentionaly.
*/
/*
KB article http://support.microsoft.com/default.aspx?scid=kb;en-us;274201
Notifies the client application that this resource contained a
Content-Disposition header that indicates that this resource is an attachment.
The content of this resource should not be automatically displayed.
Client applications should request permission from the user.
This value was added for Internet Explorer 5.
*/
if( (FAILED(hr)) && (pPrevBSCB) )
{
//RevokeObjectParam for current BSCB, so we can register our BSCB
LPOLESTR oParam = L"_BSCB_Holder_";
hr = pbc->RevokeObjectParam(oParam);
if(SUCCEEDED(hr))
{
//Attempt register again, should succeed now
hr = RegisterBindStatusCallback(pbc,
reinterpret_cast<ibindstatuscallback*>(filedl), 0, 0L);
if(SUCCEEDED(hr))
{
filedl->m_pPrevBSCB = pPrevBSCB;
//Need to add ref to our DLMan
filedl->AddRef();
pPrevBSCB->AddRef();
filedl->m_pBindCtx = pbc;
pbc->AddRef();
}
}
}
if(SUCCEEDED(hr))
{
hr = pmk->BindToStorage(pbc, 0, IID_IStream, (void**)&pstm);
}
else //add right-click "save target as" support
{
delete filedl;
USES_CONVERSION;
LPOLESTR data = NULL;
pmk->GetDisplayName(pbc, NULL, &data);
TCHAR* myUrl = OLE2T(data);
HRESULT hr;
hr = URLDownloadToFile(NULL,myUrl,NULL,0,NULL);
if ( SUCCEEDED(hr) )
{
}
else
{
LPTSTR lpszErrorMessage;
if ( FormatMessage ( FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, hr,
MAKELANGID ( LANG_NEUTRAL, SUBLANG_DEFAULT ),
(LPTSTR) &lpszErrorMessage, 0, NULL ))
{
//sMsg.Format ( _T("Download failed. Error = 0x%08lX\n\n%s"),
// (DWORD) hr, lpszErrorMessage );
LocalFree ( lpszErrorMessage );
}
else
{
//sMsg.Format ( _T("Download failed. Error = 0x%08lX\n\nNo message available."),
// (DWORD) hr );
}
}
}
return hr;
}
History
|
|
|
|
|
Dear all,
I am writing a CMyFileDialog class inherited from CFileDialogImpl. When I choose some special file,a checkbox will show at this time. Now the question is I don't know how to create a dynamic checkbox. or is there other way to realize this function??? Waiting for the answer...;) Thanks!!!
Anna
^_^
|
|
|
|
|
Hi Anna,
Use the code
1) Get the handle of the check box control
HWND hwnd=GetDlgItem(IDC_CHECKNOX1);
2) Call the enable window function and pass TRUE if you want it to be
visible otherwise make it false.
hwnd->EnableWindow(FALSE);
OR
hwnd->EnableWindow(TRUE);
Hope this solves your problem.
Do reply
Dhiraj
Dhiraj Kumar Saini
|
|
|
|
|
hi,Saini
Thanks for your help. I use "this->ShowWindow(TRUE)" to make the checkbox show. But does hWnd have the function "EnableWindow()"??? It seems that it only has one variable...
|
|
|
|
|
Dear ATL people,
I have a maybe-newbie question, so sorry for that. I have a
CAtlExeModuleT (see code below) and want to adjust a sample that I
got. It started by creating a modal CAxDialogImpl object in the
PreMessageLoop of the CAtlExeModuleT. What I wanted to do is to make
the dialog modeless so that I can display additionally a CWindowImpl
(with the option to make it fullsceen later, to display jpegs).
So is it possible to create a CAxDialogImpl and a CWindowImpl which
both have the desktop as parent (giving NULL as first parameter in
the Create call)? Or do they have to be related to each other (forming
a chain of parent-child)? When I execute the code below the program
runs for short and then ends without displaying anything. I added
a Sleep(5000) after the window creation and the window was visible.
So it seems to be a matter of scope. But the dialog wasn't visible.
How could I get it work that the window AND the modeless dialog are
created correctly and do not go out of scope so that the event
handling works properly? Do I have to put them in PreMessageLoop
(I tried this, but the effect was the same; do I need
PreMessageLoop)? - I would prefer a solution with _tWinMain only to
get rid of the PreMessageLoop if possible.
Please help, I think it's not a hard problem for someone who has some
experience with the ATL. You would really help me greatly because I am
totally stuck despite two books on ATL and the web (I only found exam-
ples where they use the older CCom stuff with a main message loop in
_tWinMain and TranslateMessage(&msg) and DispatchMessage(&ms) into it)
but not how to use ATL windows in context of the CAtlExeModuleT like
I need in this case (ATL 8.0, Visual Studio 2005).
So with the hope on help I send you
Best regards,
Peter.
Here comes the code:
#include "stdafx.h"
#include "resource.h"
#include "mainDialog.h"
class CMyWindow : public CWindowImpl<CMyWindow>
{
public:
DECLARE_WND_CLASS("MyName")
BEGIN_MSG_MAP(CMyWindow)
MESSAGE_HANDLER(WM_PAINT, OnPaint)
END_MSG_MAP()
LRESULT OnPaint(UINT nMsg, WPARAM wParam,
LPARAM lParam, BOOL& bHandled)
{
return 0;
}
};
class CSampleModule : public CAtlExeModuleT< CSampleModule >
{
public :
HRESULT PreMessageLoop(int nShowCmd)
{
HRESULT hr = CAtlExeModuleT<SampleModule>::PreMessageLoop(nShowCmd);
if (FAILED(hr))
return hr;
return S_FALSE;
}
};
CSampleModule _AtlModule;
extern "C" int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE ,
LPTSTR , int nShowCmd)
{
CMainDialog* mainDlg = new CMainDialog();
mainDlg->Create(NULL);
CMyWindow* myWnd = new CMyWindow();
myWnd->Create( 0, CWindow::rcDefault, "Image Test",
WS_OVERLAPPEDWINDOW, WS_EX_CLIENTEDGE );
if( !myWnd ) {
return FALSE;
}
myWnd->CenterWindow();
myWnd->ShowWindow( nShowCmd );
myWnd->UpdateWindow();
return _AtlModule.WinMain(nShowCmd);
}
|
|
|
|
|
Passing Cstring to BSTR gets truncated.The lengthy strings gets truncated.
CString str= "fjgdfldfkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"
add(_btsr_t(str.AllocString,false))
add(BSTR arg1)
{
}
I am passing in this maaner to a function which accepts BSTR , but the string gets truncated.
Thanks in Advance.
|
|
|
|
|
Why you are using _bstr_t ?
Modify code to,
CString str= "fjgdfldfkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk"
BSTR bsStr = str.AllocSysString();
add(bsStr);
Prasad
MS MVP - VC++
|
|
|
|
|
I want to craete a custom right click context menu for Internet Explorer whenever the user takes the pointer over an image and right clicks. The custom menu context should have icons along with the text for menu items.
i want the code for the events fired on clicking menu items.
Please help me out.
Thanks In advance.
Dhiraj
Dhiraj Kumar Saini
|
|
|
|
|
|
The API AlphaBlend doesn't work in ATL owner-draw button.
why?
and how to implement the spark effect when pushed a button?
thx!!
C++, MFC, ATL, PHP
|
|
|
|