|
Thanks bhai.
|
|
|
|
|
Hian Brother,
mr. Ravi Project is COOL
but there one more project on CP that can help you, search for "AmhttpSocket", it is samll class that encapsulate what you want.
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Hello,
I am having trouble in compiling this project of mine. I will try to make myself clear so please bear with me for awhile...
The scenario
The workspace consists of 4 projects, 3 of them generating static libraries:
- core.lib;
- controls.lib ==> dependant on core.lib;
- db.lib ==> also dependant on core.lib;
The fourth project is the application which uses classes/objects from the 3 libraries I've just described.
The problem
I have just added a new class (CXList ) to core.lib. This class allows the processing of a complex linked-list with variable data types - it is therefore a class template. Before including it in core.lib I tested it in a separate project and it performed just fine.
But, when I included it in the master workspace described above and after having updated the whole project, I couldn't believe my eyes when I hit the Build button! I got loads of linking errors telling me that all (yes all) of the CXList objects (and methods) were not found in any of the libs (you know, the external object not found in db.lib kind of error).
Is this some kind of a class template issue that I am not aware of?
If you think you can shed some light on what I'm experiencing here, please do let me know.
Thank you for your time,
David Nimrod
|
|
|
|
|
By class template i assume you mean CXList is defined like :
template<class TT> class CXList { ... };
If not then i don't know what you mean so stop reading.
Ok, what you have defined with a template is an idea. There is NO CODE until you create a instance of the template by specifying the template parameters.
e.g.
CXList<int> blah;
So even though the template code is included in code.lib project file no object code is produced when you compile.
If you have specific instances of CXList that you want to export from core.lib then you can do the following :
In a header file add :
typedef CXList<int> CXListInt; // optional
In a source file add :
template class __declspec(dllexport) CXList<int>; // required
This will create all the instance code for CXList<int> and export all the methods.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
cmk wrote:
In a source file add :
template class __declspec(dllexport) CXList; // required
That's precisely what I mean.
cmk wrote:
By class template i assume you mean CXList is defined like :
template<class tt=""> class CXList { ... };
Ahh! The magic code to make it work!
I thought the compiler did this automatically. Can you provide me with an explanation as to why you have to do it like so?
Thanks a lot, cmk. You have been very helpful indeed!
David Nimrod
|
|
|
|
|
Whoops, i made a typo
template class __declspec(dllexport) CXList;
should be,
template class __declspec(dllexport) CXList<int>;
dNimrod#X wrote:
Can you provide me with an explanation as to why you have to do it like so?
Because a template is just that - a template that the compiler can use to create code at compile time when you specialize the template.
When you define the template class template<class TT> MyClassT { ... };
The TT is a variable/placeholder. What do you expect the compiler to do with TT unless you specify what it is ?
But, when you say MyClass<int> the compiler goes 'ahhh, now i can replace all cases of TT with int and compile'.
As for exporting, given the above you can't export a template class like you would a normal class. So the syntax i provided was the solution 'they' decided on.
It tells the compiler that, even if CXList<int> isn't used anywhere, you want it to create all methods and export them. If you didn't do this the compiler would optimize away the code.
The same syntax can be used to export function template instances, or specific class template method instances (ie you don't want to export all methods from a class template).
...cmk
Save the whales - collect the whole set
|
|
|
|
|
I have a function within which I launch off a process using createprocess. This function has the signature:
int runMyCAD(char* alg_str, char* output_dir, char* file_path, char* list_file_name, char* serverAddress);
The process I am launching needs to be passed the arguments that came in, so I am trying to build the lpCommandLine for the CreateProcess.
CString CommandLine = "CadcacControl.exe -s ";
CommandLine += *serverAddress;
CommandLine += "- p ";
CommandLine += *file_path;
CommandLine += " - d ";
CommandLine += *output_dir;
CommandLine += " - a ";
CommandLine += *alg_str;
CommandLine += " - l ";
CommandLine += *list_file_name;
CreateProcess( appDir + "fileserver.exe", (LPCTSTR)CommandLine,
NULL,NULL,FALSE,0,NULL,
NULL,&StartupInfo,&ProcessInfo)
but I get the compile error:
feedfile.cpp(275) : error C2664: 'CreateProcessA' : cannot convert parameter 2 from 'const char *' to 'char *'
What do I need to do to fix this?
Thanks,
sb
|
|
|
|
|
This question is asked about a thousand times a day
See the C++ forum FAQ
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I am looking for code for a list control (like CListCtrl) that displays an edit box and button for a current item or sub-item. Microsoft has implemented this in, among other things, the Options/Projects/VC++ Directories dialog where you can type in a directory or click the button for the Open File dialog.
I'm sure it's relatively easy to implement but I even more sure that someone must have already done this and I don't want to re-invent the wheel.
Does any one know of an implementation of this? Any help is greatly appreciated.
|
|
|
|
|
Hello guys,
someone can give me an example on how to use the SetSecurityInfo for a process.
The aim is to set the SecurityInfo for my process in a way that an external process has only the permission to execute it, and deny the operations like ReadProcessMemory, WriteProcessMemory, or OpenProcess with PROCESS_VM_READ, PROCESS_VM_WRITE options...
I really appreciate your help,
Fabio
|
|
|
|
|
Is anyone know know how to write c/c++ code to print out a .jpg image with the given filename directly on a printer without displaying the image itself and without print dialogue popup, but still able to set up the needed parameters?
Many thanks,
David
|
|
|
|
|
decompress it, load it to a memory device context and send it to the printer. where is the problem?
Don't try it, just do it!
|
|
|
|
|
Hello everyone, I need help with an ODBC Api called SQLRowCount().
This Api can only be used to get the number of "affected" rows after an UPDATE, DELETE or INSERT statement. But what if I want the returned rows of a SELECT statement?
(SQLRowCount() is returning -1 then)
I've already browsed the ODBC help files but I didn't find any similar Api.
Any suggestions?
Regards,
Alex
Don't try it, just do it!
|
|
|
|
|
If your query was something like SELECT name,address,phone FROM table WHERE name LIKE 'TER*' then you can simply change it to SELECT COUNT(*) FROM table WHERE name LIKE 'TER*' to get the number of rows returned. Is that anywhere near what you are after?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Perhaps a solution, but not really the one I was looking for. I'm also a PHP coder, and I'm used to work with MySQL, which has an Api called mysql_num_rows, which also returns the SELECT row count. There is a function for ODBC, too, called odbc_num_rows, but this one does only work with some ODBC drivers (the Microsft Access Driver for example doesn't support this, -1 will be returned).
I am currently working on a simple COM server to make ODBC access easier, and for that reason a function like SQLRowCount, working for SELECT requests, would be very useful, because changing the SQL request by using string operations will make the code much slower, more difficult to code and there may also be much more errors.
Any other solutions?
Don't try it, just do it!
|
|
|
|
|
As far as i know there is no reliable way to do this across all drivers.
As i understand things (YMMV) :
When you call SQLExecute*() many drivers will return before the complete result set is built - that is they work async. This is not the same as using SQLSetStmtAttr(SQL_ATTR_ASYNC_ENABLE). This is more likely for static forward-only cursors.
The idea is that they can keep chugging away at building the result set as you pull results out of the set via SQLFetch*().
The upshot is that the total number of rows may not be known at the time SQLExecute*() returns.
There are ways to force the issue, but they all introduce significant overhead.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
I've built a custom appwizard that creates an ActiveX Component project in the way I want it to, but I'd like to add functionality to it so that it can create projects that are more complex. The wizard presently creates files for a simple class structure, but I'd like it to be able to create a class hierarchy, requesting the number of and the names of the derived classes, and I'd like it use the same template files for creating each derived class (with different value(s) placed into the m_Dictionary variable). Is this possible?
-Rob
__________________________________________________________________________
....you guys start coding and I'll go ask them what they want it to do....
|
|
|
|
|
Hi Friends,
I have some set of problems. Please help me in solving these problems.
1) How can I print to default printer. I tried it by using.
CPrintDialog mPrintDialog(FALSE);
if(mPrintDialog.GetDefaults())
{
CDC dc;
dc.Attach(mPrintDialog.m_pd.hDC);
this->PrintClient(&dc, PRF_CLIENT);
}
But this did not worked. Please help me with this problem.
2) I am using MDI application. I tried to handle WM_KEYDOWN of CMainFrame class inorder to capture ESC key.
But it did not worked. Actually when ever ESC is pressed I want to close the application.
3) My another problem is I want to make my application Full Screen. Like I want my view to be of Full screen. When ever user double clicks on the view. I have to make the view a Full Screen. I don't want to see the Background Frame Window. I want my application View to be screen occupyieng whole Monitor screen.
Please help me as soon as possible.
Thanks for your help!!!!
If you have faith in the cause and
then means and in GOD, the hot
Sun will be cool for you.
|
|
|
|
|
DELIVER THE PROMISE wrote:
But this did not worked.
Which means nothing useful. What did not work about it? Was there a compiler/linker error? Did an assertion fire? Was an exception thrown? Did you single-step through the code to see what condition might have cause it to "not work?" What type of object is this ?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Please help me!
This is not answer to my question. This is very very urgent.
Thanks & regards,
Promise
|
|
|
|
|
David was asking you to expand on the information you have given in order to have a better understanding of your problem.
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 Williams (Little Britain)
|
|
|
|
|
I'm glad to see that at least one person understood where I was going with my inquiries!
Maybe I shouldn't have been so hasty to drop out of mind-reading school.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
For point 2. Have you tried setting up accelerator keys? Have one that handles ESC.
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 Williams (Little Britain)
|
|
|
|
|
Hello.
Could you please help me. I need to customize regular Folder view. I
need to split it in two parts:
1)To have regular detailed view on the top.
2)To have another view which will show some additional information
about the file selected in the detailed view at the bottom.
Is it possible to achive that using Shell Extensions?
Thank you.
|
|
|
|
|
Hi,
I'm writing a Flight Simulator DLL, the DLL creates a thread that runs a UI that runs as a child of FS.
Now not any problem in FS window mode, but when I switch to full screen mode and click on the UI (which is shown on top of FS in full screen), windows deactivates the flight simulator by minimizing it and also minimizing the UI.
Without a thread it was working, but I wanted a sep thread for the UI since code behind the UI is doing expensive work.
I create the dialog as follows:
MyEnumWindowsProcCls Cls;
Cls.dwProcessId = GetCurrentProcessId();
Cls.hWnd = 0;
Cls.dwThreadId = 0;
EnumWindows(EnumWindowsProc,(LPARAM)&Cls);
fsWnd_ = new CWnd();
fsWnd_->Attach(Cls.hWnd);
dlg->Create(IDD_MAIN, fsWnd_);
The EnumWindowsProc catches the FS window:
BOOL CALLBACK EnumWindowsProc(HWND hWnd,LPARAM lParam)
{
static MyEnumWindowsProcCls* pCls=(MyEnumWindowsProcCls*) lParam;
DWORD dwProcessId;
DWORD dwThreadId;
dwThreadId=GetWindowThreadProcessId(hWnd,&dwProcessId);
if (dwProcessId==pCls->dwProcessId)
{
char clas[512];
GetClassName(hWnd,clas,sizeof(clas));
HWND hWndParent=(HWND)GetWindowLong(hWnd,GWL_HWNDPARENT);
if (hWndParent==NULL)
if (strcmp(clas,"FS98MAIN")==0)
{
pCls->hWnd = hWnd;
pCls->dwThreadId = dwThreadId;
return FALSE;
}
}
return TRUE;
}
Anybody an idea of what I'm doing wrong? Is it possible at all to create a child window in another thread?
Thx
Kenny
|
|
|
|