|
Thanks a lot Mr. Gary R. Wheeler,
1. I understood what you wrote, but the whole point is not to load the Implementation DLL by the TestDriver project. Is it possible that the TestDriver will be aware only about the Interfaces?
2. Another important point is that my Interfaces contain pure virtual interfaces and some implementations as well, so I could not remain them just in header files. May be I should use static lib??
3. I tried to think in the direction of templates to solve the problem, but still did not come to any conclusion.
Thanks again, Julia1.
|
|
|
|
|
I think part of our stumbling block here is the notion of an 'interface'. AFAIK in .NET (C#) and Java, an 'Interface' is a concrete, compilable language feature that specifies how two pieces of code communicate. There is no corresponding language feature in a pure C++ DLL. An 'interface' is a descriptive term only. A DLL simply provides executable code with known entry points, described either through 'C' style function signatures or as C++ classes.
If I understand correctly, what you're trying to accomplish is to have your TestDriver program load an Interfaces DLL, rather than loading an Implementation DLL directly. What I don't understand is how your Implementation DLL will ever get loaded. In your original post, you state that the Implementation DLL loads the Interfaces DLL. You then have the TestDriver program and the Implementation DLL loading the Interfaces DLL, but no one loads the implementation DLL. For the Implementation DLL to be loaded, there has to be some code, either an application that references the Implementation DLL directly, or some DLL that is uses that references the Implementation DLL.
My point in my previous post was that I don't think you don't need to have two DLL's to accomplish your goal of being able to replace the Implementation DLL at will without having to recompile the TestDriver application. Have your TestDriver application use the Implementation DLL directly; no Interface DLL is required. You can replace the Implementation DLL as needed. As long as you don't change the function signatures or class definitions for the code implemented in the DLL, this will work correctly.
I'm sorry if I'm not understanding your situation exactly. I hope this explains my earlier reply a little better.
Software Zen: delete this;
|
|
|
|
|
Hey Guys,
I know the following might sound like a silly question, but I have a project which is a Doc-View SDI MFC project. Any way a requirement has emerged which means I need to use combo boxes in the actual view window.
Does anyone have any experience at using something like this, In particular can you use a combo box in the view class of an SDI app? If so how do you incorporate it.
Looking forward to your reply.
Best Regards
Danny Nowlan
|
|
|
|
|
have you looked at CFormView?
cje
|
|
|
|
|
Since controls are just windows you can use them as a child window on any window.
An easy way is to add a CComboBox member to your window class:
CComboBox m_MyCombobox;
Add a WM_CREATE handler to the window class. In the handler call Create() for the combo box.
int CMyWindow::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
m_MyCombobox.Create(CBS_DROPDOWN, CRect(10,10,100,15), this, IDC_MYCOMBOBOX);
...possibly populate the combo box here using AddString() etc ...
return 0;
}
This example places a 100 wide by 15 high CBS_DROPDOWN style combo box at 10,10 in the window.
You could handle WM_SIZE in the window and move the combo box in response to the user resizing the
window.
Hope this helps get you started!
Mark
|
|
|
|
|
Hey Mark,
Thanks for that mate. I implemented it and I had no errors, however the Combo box still isn't showing up. I also created a IDC_MYCOMBOX resource with the type set to child. Any ideas?
For what its worth I am dealing with a view that is derived from CView as opposed to CFormView. Is that part of my problem?
Thanks again to everyone for all their help.
Danny
|
|
|
|
|
Danny Nowlan wrote: I implemented it and I had no errors, however the Combo box still isn't showing up.
Sorry The limited example code didn't have enough style flags.
try
m_MyCombobox.Create(CBS_DROPDOWN|WS_VISIBLE|WS_CHILD, CRect(10,10,100,15), this, IDC_MYCOMBOBOX);
Calling MyCombobox.ShowWindow(SW_SHOW) would make it show as well. Useful if you want to
create it hidden and show it later I suppose.
Mark
|
|
|
|
|
In my application I connect to a site and request a search. In the source code of the webpage the server sends back, there's a link I need to follow. I was thinking something like this would work:
connect
send: "GET /?name=example HTTP/1.1\r\nHost: example.com\r\nConnection: Keep-Alive\r\n\r\n"
retrieve the page returned and parse it
send: "GET /?id={what I parsed out} HTTP/1.1\r\nHost:example.com\r\nConnection: Close\r\n\r\n"
I retrieve the page like this:
void ReceiveDoneCallback() {
if (bytes read > 0) { read more }
else { parse message; generate second request; }
}
Now this works but not the way I want it to. It takes about 20 seconds before the server closes the connection. That is, when the Connection: Keep-Alive header is sent along. I think it's because I still call another BeginReceive while there's bytes read. I workaround could be to compare bytesRead to buffer->Length, but what if the output page is a multiple of my output buffer size?
Can someone tell me how this is done?
Thanks in advance,
Frank
|
|
|
|
|
Are you using WinInet for this? If so, call InternetQueryDataAvailable() to tell how many bytes of the response are waiting for you to read.
|
|
|
|
|
I asked around a bit and I was told that I need to read out the Content-Length header which the server sends back. I was very proud of myself when I got that done, but then I found out that's the length of the stuff that comes after the headers, and Content-Length isn't the latest header sent
Anyway, I also managed to fix that up. Here's the code I used.. if anyone ever uses the search button and finds this.
void ReceiveDone(IAsyncResult^ ar) {
Socket^ s = safe_cast<Socket^>(ar->AsyncState);
try {
int bytesRead = s->EndReceive(ar);
String^ read = Encoding::ASCII->GetString(buffer, 0, bytesRead);
sb->Append(read);
TimesRead++;
if (ReadingHeaders == true) {
Int32 index = sb->ToString()->IndexOf("\r\n\r\n");
if ((index != -1) && (ContentLength != 0)) {
TimesRead = 0;
sb->Remove(0, index + 4);
ReadingHeaders = false;
}
else if (ContentLength == 0) {
array<String^>^ seperators = gcnew array<String^>{"\r\n", ": "};
array<String^>^ headers = sb->ToString()->Split(seperators,StringSplitOptions::None);
Int32 index = sb->ToString()->IndexOf("Content-Length:");
if ((index != -1) && (index + 10 < sb->Length)) {
for (int i = 1; i < headers->Length; i++) {
if ((headers[i] == "Content-Length") && (headers[i+1]->ToString() != "")) {
Int32::TryParse(headers[i+1]->ToString(), ContentLength);
ReadsRequired = (ContentLength / buffer->Length);
if (ContentLength % buffer->Length > 0)
ReadsRequired++;
}
}
}
}
}
if ((ReadingHeaders == true) || (TimesRead < ReadsRequired))
sock->BeginReceive(buffer, 0, buffer->Length,
SocketFlags::None, gcnew AsyncCallback(this, &StatsSock::ReceiveDone), sock);
else
ParseDelegate->Invoke(sb->ToString(), this);
}
catch (Exception^ e) { MessageBox::Show(e->ToString()); }
}
|
|
|
|
|
I tryed SetFocus() but it didn't work.
Moreno
|
|
|
|
|
Use GotoDlgCtrl() instead.
example:
GotoDlgCtrl(GetDlgItem(IDC_MYCONTROL));
Mark
|
|
|
|
|
Hello everyone,
I am looking for an efficient way to implement matrix multiplication in C/C++. Are there any existing good ways?
The matrix is stored in an one-dimentional array.
thanks in advance,
George
|
|
|
|
|
Hello,
I'm trying to add the following lib: [url]http://id3lib.sourceforge.net/[/url]
to my VS2003 project, I don't understand the instructions:
[code]
B)***Your project wants to link id3lib static, and has mfc linked dynamic or has no MFC:
1) Rename config.h.win32 to config.h
2) include libprj/id3lib.dsp and zlib/prj/zlib.dsp to your workspace
3) make your project dependend on id3lib, and make id3lib dependend on zlib
4) Add /D ID3LIB_LINKOPTION=1 to your project options (settings, C/C++ tab)
5) Add the following include dirs to your program:
/I <path_to_id3lib>\\include /I <path_to_id3lib>\\include\\id3
6) (add your code which uses id3lib)
7) Try to compile, and see if you need any of the following:
(debug) /nodefaultlib:"msvcprtd" or(release) /nodefaultlib:"msvcprt"
(debug) /nodefaultlib:"MSVCRTD" or(release) /nodefaultlib:"MSVCRT"
(debug) /nodefaultlib:"libcmtd" or(release) /nodefaultlib:"libcmt"
different programs may require different 'nodefaultlib' 's, or none at all, these worked for me.
If none you try work, revert to C)
[/code]
Please help, without this lib I can't go on with my project.
Thank you.
|
|
|
|
|
Which bit do you not understand ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
2 - 5
I'm not sure what do they want me to do.
I'm sorry if this question is really stupid, I'm just really new to VS, I'm not sure where to put all of this.
|
|
|
|
|
They are VC6 instructions. Which means the code may not even compile in VC2003. I'd start by loading the project in VC2003 and see if it compiles. Adding projects to the solution is set 2.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I tried to add this to a project, but I'm not sure where am I suppose to add all this in VS2003, as I said, I've never done linking before in VS.
|
|
|
|
|
Hi,
how should I make my MFC single dialog box application so that, it could change main dialog box?
My application allows one instance (I used CSingleInstanceApp), so I want to change dialox box after user tryied to run it more time (with different parameters).
It is posible to assing CWinApp::m_pMainWnd another dialog box during aplication runs ?
rudozkv
-- modified at 5:17 Sunday 15th October, 2006
|
|
|
|
|
When you start the second instance, and you get acknowledged that another instance is running you can find that app. and send it a registered message.
Then you'll be able to handle that message in the first application.
Hope this helps.
|
|
|
|
|
Hi,
I need to sort the items in a listbox in assending/descending order. To sort in ascending order I copy the list item into a CStringList object then destroy the listbox and recreate it with style LBS_SORT . Then I add the items back again.
But how do I sort it in the descending order?
Thanks.
Fortitudine Vincimus!
|
|
|
|
|
The visual style LBS_SORT is not intended to sort anything automatically, it is only in order to allow you to click on the header of the column and receive a notification message in order to be able to handle that notification.
In other words, this is not handled automatically so you'll need to get this notification message and then sort it programatically.
Hope this helps.
|
|
|
|
|
Hi all:
Thanks for the suggestions in my original post... I think I should have worded my question differently though.
Thre original question:
"I am working on an MFC application (Visual Studio/C++) that has to grab a screen shot from a frame grabber and send it to the default printer with landscape orientation. This has to be done with no operator intervention other than clicking on a "Print" button in the main dialog - no preview or print dialog. I'm able to grab the frame, but I'm having no success with the printing."
What I really have is not a bitmap in the MFC sense, but a pointer to a big bunch of pixels. I can not seem to figure out how to get those pixels in a form that I can print - what comes out of the printer is just a black rectangle.
Again, any help would be appreciated.
Bob.
|
|
|
|
|
Did you use CreateDIBitmap[^] to get a HBITMAP? How exactly are you passing your bitmap to the printer?
|
|
|
|
|
I think you aksed this question if your problem is with bitmaps see here[^] maybe its some helpful for you
|
|
|
|