|
CODE:
LPCTSTR pszLicenseKey = "1410[Digisoft]888015934085437";
CComPtr<iclassfactory2>pICF2;
HRESULT hr1 = CoGetClassObject(__uuidof(ProxyGW),CLSCTX_INPROC_SERVER,NULL,IID_IClassFactory2,(void**)&pICF2);
if(FAILED(hr1))
{
CString strMsg;
strMsg.Format("Error (%X) creating ProxyGW", hr1);
AfxMessageBox(strMsg);
return false;
}
hr1 = CoGetClassObject(__uuidof(ProxyGW),CLSCTX_INPROC_SERVER,NULL,IID_IClassFactory2,(void**)&pICF2);
IProxyGW *pUIRaw;
pICF2->CreateLicenseLic(NULL,NULL,__uuidof(ProxyGW),_bstr_t(pszLicenseKey),(void**)&pUIRaw);
ERROR MESSAGE is this:
D:\tsadmin\HostInfoList.cpp(66) : error C2039: 'CreateLicenseLic' : is not a member of '_NoAddRefReleaseOnCComPtr<struct iclassfactory2="">'
|
|
|
|
|
In the COM Declaration Use DECLARE_CLASSFACTORY2(THE_LIC_CLASS)
Cheers
|
|
|
|
|
http://www.autodidact.co.il/
|
|
|
|
|
Too bad I can't read a word of it Is there an English translation in store for it?
|
|
|
|
|
http://www.autodidact.co.il/
|
|
|
|
|
Alona,
Your site is in Hebrew, and a lot of people speak English...
Could you possibly offer a version of your site in English?
Brian Hart
|
|
|
|
|
Hi all,
I have somewhat simple DOS command line, but I can't get it to work.
Here is my code:
// the line to be executed:
// c:\a\wzzip c:\b\b.zip c:\b\*.*
// my first try, it return "The specified file was not found."
ShellExecute(NULL, "open", "C:\\a\\wzzip C:\\b\\b.zip C:\\b\\*.*", NULL, NULL, SW_SHOWNORMAL);
//my second try
WinExec ("c:\\a\\wzzip c:\\b\\b.zip c:\\b\\*.*", SW_SHOW);
//my third try
_spawnl( _P_WAIT, "C:\\a\\wzzip C:\\b\\b.zip C:\\b\\*.*", "C:\\a\\wzzip C:\\b\\b.zip C:\\b\\*.*", NULL, NULL, NULL);
Can anyone please help me? Thanks a lot.
|
|
|
|
|
Hi,
Why not trying the 'system' command? I've done it already a few times to execute a Dos command like you would give it on the command line, and this works fine.
Give it a try?
Best regards,
Geert
|
|
|
|
|
Thank you very much Geert
It works wonderfully!
|
|
|
|
|
I know, i know, this sould trivial, but it's not! CRichEditCtrl has a method to set the default character properties. Here's what I used:
CHARFORMAT cf;
DWORD dwMask = GetRichEditCtrl().GetDefaultCharFormat(cf);
cf.dwMask = dwMask | CFM_COLOR;
cf.crTextColor = m_crFace;
cf.dwEffects &= ~CFE_AUTOCOLOR;
GetRichEditCtrl().SetDefaultCharFormat(cf);
Unfortunately, this does nothing. I added the cf.dwEffects when the cf.crTextColor didn't work. Then I tried calling this code from various places. I put it in the view's OnInitialUpdate(), then ran it from a menu command. Then I tried adding pDC->SetTextColor(m_crFace) to OnPrepareDC(), but that did work either. The font always remains black.
Has anyone else had a problem doing this and found a solution?
Thanks,
Mike Newberry
|
|
|
|
|
Are you calling SetDefaultCharFormat() before putting text in the control? SetDefaultCharFormat() has no effect on text that's alredy in the control.
|
|
|
|
|
Mike Dunn's suggestion started me thinking about the order of things adn I found the solution. I was calling GetRichEditCtrl().SetFont( m_EditorFont ) to set the font immediately *after* calling SetDefaultCharFormat(). Apparently, SetFont() set my font characteristics correctly, but reverted the color to the default system color since the LOGFONT has no provision for color information.
There are 2 ways to fix this: 1) set all the font info in the CHARFORMAT struct and skip the SetFont() call, or 2) call SetFont() *before* calling SetDefaultCharFormat(). I did method 2 to get a quick result. When I did this, the text color automatically changed for all the text *already* in the control, which is the behavior I wanted. I called these methods from the CRichEditView's OnInitialUpdate() method.
Thanks to Mike Dunn for providing the spark to figure this out!
Mike Newberry
|
|
|
|
|
i:\eldis3\bib_source\eurodialoge\errdlg.h(47) : warning C4251: 'm_text' : class 'CString' needs to have dll-interface to be used by clients of class 'ErrDlg'
c:\programme\microsoft visual studio\vc98\mfc\include\afx.h(368) : see declaration of 'CString'
Since I use a lot of lib's (dll's) I get this warning for nearly everything I am exporting.
I can't see any problems with this warning (There are (I hope so) no problems at runtime) but I want to get rid of
these endless warnings at compile time.
Does anyone know from where these warnings are coming?
Does anyone know how to get rid of these warnings?
Thank you...
|
|
|
|
|
Well, you could use
#pragma warning(disable:4251)
But I think this is a warning based upon some other problem you are not diagnosing.
My suspicion is that you might have some of your DLL statically linked to MFC and some are dynamically linked.
Good luck! I was just at a location where they had mixed and matched them with VC 5.0, and wow! did things really go crazy when the VC 6.0 was first used. Had to go through all modules of all related projects and settle on one type or another.
|
|
|
|
|
In the header file for each class in your DLL, specify AFX_EXT_CLASS just before the name of the class and then the whole class will be exported.
ie.
class AFX_EXT_CLASS CErrorDialog : public CDialog
{
//..
};
and then remove any and all export stuff you have anywhere else for that class.
Brian
|
|
|
|
|
Situation:
There is one machine (host) to which number of other machines (subscribers) want to establish connection over Internet. None of the subscribers is under the same domain as host. The idea is that the subscribers could establish as much real-time communication link over Internet to the host, which can only relay on Internet connection. The communication would mostly involve text base exchange.
Question:
I would use some guidelines on how to construct a solution, Windows Sockets, RPC SDK, anything else please suggests. Is it possible? I would also appreciate any samples that you many know off.
Thanks in advance.
|
|
|
|
|
Hi,
You'd need a program which uses winsock to register on a certain port,
then reads the requests from the clients, parses them, connects to the internet, creates new requests and sends
them to the internet servers, gets back its data, removes the header data, sends back the data to the
client programs. And then goes on listening on its port for the next client.
Just an idea...
Chris.
|
|
|
|
|
Hi,
I have a Single Doc, Multiple views Application and I have a Menu option called "options" which accepts the Default location to Save Files.
How do I set the Default Location ?What is the Function used and How do I use it? so that, when the user says File->Save, it should show the deafault directory to save the
file.
Any Suggestions...
Thank you
Priya
|
|
|
|
|
Try this code
[CODE]
OPENFILENAME ofn;
char defaultFileName[MAX_PATH + 1] = "Default file name";
char szFileTitle[MAX_PATH + 1];
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = NULL;
ofn.hInstance = GetModuleHandle(NULL);
ofn.lpstrFilter = "All Files (*.*)\0*.*\0\0";
ofn.lpstrCustomFilter = (LPTSTR) NULL;
ofn.nMaxCustFilter = 0L;
ofn.nFilterIndex = 1L;
ofn.lpstrFile = defaultFileName;
ofn.nMaxFile = sizeof(defaultFileName);
ofn.lpstrFileTitle = szFileTitle;
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrInitialDir = "C:\\DefaultDir";
ofn.lpstrTitle = __TEXT("Save Da Doc as...");
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = NULL;
ofn.lCustData = 0;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY |
OFN_EXPLORER | OFN_LONGNAMES;
int result = GetSaveFileName(&ofn);
if (result == IDOK) {
MessageBox(defaultFileName,"Full Path is ");
MessageBox(szFileTitle,"File Name only is ");
}
[CODE]
Note There is also easier ways with MFC ...
Hope It will help
ALfadhly
|
|
|
|
|
SetCurrentDirectory
The SetCurrentDirectory function changes the current directory for the current process.
BOOL SetCurrentDirectory(
LPCTSTR lpPathName // pointer to name of new current directory
);
Parameters
lpPathName
Pointer to a null-terminated string that specifies the path to the new current directory. This parameter may be a relative path or a fully qualified path. In either case, the fully qualified path of the specified directory is calculated and stored as the current directory.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
Each process has a single current directory made up of two parts:
A disk designator that is either a drive letter followed by a colon, or a server name and share name (\\servername\sharename)
A directory on the disk designator
|
|
|
|
|
SetCurrentDirectory
Changes the current directory for the current process
This means that if your program is writting to temporary files or reading from other files you will be effecting the location of all subsequent File I/O operations which you don't specify the Exact Directory location for.
Do you really want to do that.?
Alfadhly
|
|
|
|
|
No this means that you do a GetCurrentDirectory SetCurrentDirectory, do your file saving and return to the directory that you retrieved with GetCurrentDirectory.
But anyway, as you never can be sure what the current directory is, unless you set it yourself,you should never try to read/write without an exact directory location and temorary files should go into the TEMP variable or the winnt\system.
|
|
|
|
|
You will be pleasantly surprised to find that Windows Terminal Services Edition might prevent you from writing altogether to the Windows\System folder.
There is a call to obtain the temporary directory that should be used, I think it is GetTempDirectory().
Since Windows 2000 might allow multiple logons, I have noticed that the temporary directory is different for each user.
|
|
|
|
|
True Blake,
This is the same reason a copy of Office 97 will not work on Win2000
|
|
|
|
|
Hello!
Does anyone know of a NewsReader app (in C++ with MFC, preferably) with source code or of any sample that shows the basic steps to take when developing a NewsReader? I'd like to do exactly that but don't have a starting point.
Thanks in advance.
Matthias
|
|
|
|