|
Thanks for the help - it's now working with the following statement.
resource.lpRemoteName = const_cast<lptstr>((LPCTSTR)m_strResource);
The program reads a text file line by line contains drive mappings. I then pass the line as a CString to a function. The function then extracts the Drive letter and Resource name from the CString and then passes those values to NETRESOURCE and creates the connections.
It was mention that this type of casting should not be encouraged... what would be the proper way of performing this?
|
|
|
|
|
It was mention that this type of casting should not be encouraged... what would be the proper way of performing this?
This is the proper way --it is not your fault, but that of the MS guy who defined NETRESOURCE and WNetAddConnection2 witthout caring about const ness.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
See the VC forum FAQ.
--Mike--
"There are only a limited number of jobs where they will ask to see the sausage. Most of them are in movies."
-- Christian Graus, 2/11/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Hello,
I am trying to figure out if it is possible to display 256 colors in a SDI tool bar button.
Any ideas?
Rob
|
|
|
|
|
Apparently, regular CToolBar s support more than 16 colors. Check Kirk Stowell's article Using Hot Toolbar Buttons, where he discusses this issue (among other things).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
It depends on your image list. When you create your CImageList use the ILC_COLOR8 flag for 256 colors. You can even use ILC_COLOR24 for a true color bitmap.
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
How can I use OpenURL and set max retries, timeout etc…
If I use OpenURL and my connection doesn’t exist, the program crash.
Thanks Ola Carlsson
|
|
|
|
|
Hello,
I use this bit of code to pull the text(source) from a provided url.. Maybe you can see something different with this code vrs yours.
CString CUserProfileDlg::GetFile(const char *url, const char *filename)
{
char httpbuff[HTTPBUFLEN];
TCHAR szCause[2048];
CString Cause;
Cause.Format("YES");
TRY
{
CInternetSession mysession;
CStdioFile *remotefile = mysession.OpenURL(url,1,INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_RELOAD);
CFile myfile(filename, CFile::modeCreate|CFile::modeWrite|CFile::typeBinary);
int numbytes;
while (numbytes = remotefile->Read(httpbuff, HTTPBUFLEN))
{
myfile.Write(httpbuff, numbytes);
}
}
CATCH_ALL(error)
{
error->GetErrorMessage(szCause,2046,NULL);
Cause.Format("%s",szCause);
}
END_CATCH_ALL;
return (Cause);
}
Rob
|
|
|
|
|
Can I use an Active X in a ISAPI ? I have an Active x that I can use in a standard MFC application and I want to use it in an ISAPI (made in C++ with MFC), how can I do that ? I tried to put my Active X in a invisble dialog and then create the dialog and access a function that use the active x, but it only work in my standard MFC application, not in the ISAPI. Please help me, I have a prototype to deliver next week....
Thanks,
Guillaume Frechette
|
|
|
|
|
How exactly does the ActiveX fail? Can you create the ActiveX control? If not, what is the HRESULT fail code?
On important factor is that the ISAPI DLL is run in the IIS process, and is run as the IUSR_computername account. Does this account have access to this ActiveX control?
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Humm,
maybe I didn't create it correctly, because I only declare the variable of my ActiveX, initialize everything...Normally, the mfc windows create the control itself, so I presume that my invisible windows trick should works Should I do it with CreateControl(); ? Maybe it's my IUSR_MYCOMPUTER that doesn't have the right to use it. I will give it a try...
Thanks
Guillaume Frechette
|
|
|
|
|
How do I invoke a Common File Open Dialog with MFC's CFileDialog class and have its initial folder view as the root of my shell namespace extension. I have created a shell namespace extension to browse dicuments on a remote computer, when I invoke CFileDialog::DoModal() I can browse to my shell namespace OK and select files OK, but I cannot set the initialDir to the root of my shell namespace.
Many Thanks
|
|
|
|
|
The answer comes from Michael Dunn, Thank you Michael
If the namespace is under My Computer, use a path of
::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\::{Your extension's GUID}
|
|
|
|
|
There are two things I can't find out how to do in VS .NET.
1) In VC 6.0, you could press F4 to go to the source point descibed by tool output. How do I do that in .NET? (And I do have found GotoNextTask, which doesn't work for find etc.)
2) How can I specify that the app should be linked statically with MFC?
|
|
|
|
|
Tools--->customize-->keyboard button:then you can choose your keyboard mapping to VC6
Anonymous3 wrote:
How can I specify that the app should be linked statically with MFC?
Project-->properties--->configuration properties---->General-->Use of MFC
When you create your project,you can set it too
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
I'm somewhat ashamed that I didn't saw the MFC setting, but the keyboard problem remains unsolved.
If I set keyboard mapping to VC6, F4 maps to View.NextTask. In .NET, only build messages are considered as a "task". I want to be able to use a keyboard shortcut to step forward in for example the find output or output from an external tool such as LINT.
|
|
|
|
|
Modify F4 to point to "Edit.GotoNextLocation"
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
|
hi guys,
i am using a derived class from the CDaoRecordset ( Table-type )class for my database. I tryed the following code and i got an assert. The assert is in the requery() function. I cant use the Requery() function i dont know why !!!
Please see code:
in my function
m_pSet = new CDaoTable;
m_pSet->Open();
m_pSet->AddNew();
m_pSet->m_Auto = "XXX";
m_pSet->Update();
m_pSet->m_strFilter = "Auto='XXX'";
// here i got the assert
m_pSet->Requery();
...
The assert is in the daocore.cpp line 3611 "ASSERT(CanRestart());
Best Regards
Sonu
|
|
|
|
|
I think it's because of your cursel type I don't remember now which one couldn't use Requery(),but you can check in MSDN
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Hi,
I have inserted an ActiveX control in an automated session of Word in my App, but now I´m trying to get the dispatch pointer and it doesn´t work, I made:
Word::InlineShapePtr pShp = m_pWord->GetSelection()->InlineShapes->AddOLEObject(vClassType);
Word::OLEFormatPtr pFmt = pShp->OLEFormat;
IDispatch *pDispatch = pFmt->Object;
TRACE(pFmt->ClassType);
IGDIGraphics Control(pDispatch);
COleVariant x((long) 10, VT_I4);
COleVariant y((long) 10, VT_I4);
COleVariant title(TEXT("Method called from the App"));
Control.DrTextSimple(x, y, title);
(*) The IGDIGraphics is a wrapper class created by the Wizard of MFC...
The when I try to execute the method the program crashes, what I have made wrong ?, Thanks in advance
Braulio
|
|
|
|
|
Hola Braulio,
Maybe this totally misses the shot, but something caught my eye. I guess IGDIGraphics encapsulates a pointer to some COM interface called the same. If so, why are you providing a IDispatch * to the ctor of Control ? Shouldn't you obtain the proper pointer from pDispatch through QueryInterface ? Just a guess...
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hola Joaquin !
MMmm..., I think "pFmt->Object" returns and IDispatch, in theory the constructor of the wrapper class would accept that dispatch and then I could use that sugar class, but...
How could I do it in the hard way ( without wrapper classes), I would like to get the interface and then call "invoke" or get my interface, but I´m not used to COM and MFC
Thanks for your help, Bye !
Braulio
|
|
|
|
|
MMmm..., I think "pFmt->Object" returns and IDispatch, in theory the constructor of the wrapper class would accept that dispatch and then I could use that sugar class, but...
You can verify this by looking into the code for the wrapper. Some call to QueryInterface should be done inside to retrieve a proper pointer from the IDispatch * .
Also, assuming that the wrapper actually does the QueryInterface thing, can you verify that the pointer obtained is not null? Maybe what you're passing does not implement IGDIGraphic after all.
How could I do it in the hard way ( without wrapper classes), I would like to get the interface and then call "invoke" or get my interface, but I´m not used to COM and MFC
For doing that you must obtain first the GUID for the interface. With this piece of info, the rest is simple following the documentation on QueryInterface (call pFmt->Object->QueryInterface(...) ).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hola !
Finally the problem was using the class generated by the MFC wizard, I change to smart pointers, and it worked perfect ( and Smart pointers are pretty cool as well, it looks like VBasic code !).
Thanks Joaquin !, Bye !
Braulio
|
|
|
|