|
msr_codeproject wrote: (say PC-1)and shared it.
Why have you shared it if you do not want the other PC to access it?
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
My requirement is,
A printer shared in a 32-bit machine should be accessible to only 32-bit machines.
And also same case with 64-bit machines.
Now tell me how to restrict it.
Regards
msr
|
|
|
|
|
msr_codeproject wrote: A printer shared in a 32-bit machine should be accessible to only 32-bit machines.
I don't think there is any facility for this, as printers are not sensitive to 32/64 bit systems, as long as each platform has the correct printer driver.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi,
msr_codeproject wrote: My requirement is,
A printer shared in a 32-bit machine should be accessible to only 32-bit machines.
This is a very strange requirement as networks are totally insensitive to the bit width of their hosts (actually they intend to connect any heterogeneous machines using their protocol).
You can probably achieve that by partitioning in two subnetworks each having only access to its peers for resource sharing.
This can be done through your DHCP server if any, or by hand on each machine, or by inserting a router if the network topology fits.
In all cases looks like a bad idea giving more trouble than benefit
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
I need some help with this error.
I cannot compile this AVIcap function call (callback) in CView
capSetCallbackOnFrame(m_hWndCAVIFrame,FrameCallbackProc);
This is the error I am getting
error C2440: 'type cast' : cannot convert from 'long (__stdcall CMyView::*)(struct HWND__ *,struct videohdr_tag *)' to 'void *'
There is no context in which this conversion is possible
The callback is defined (per documentation) :
LRESULT CALLBACK CMyView::FrameCallbackProc(HWND hWnd, LPVIDEOHDR lpVHdr);
And implemented this way:
LRESULT CALLBACK CMyView::FrameCallbackProc(HWND hWnd, LPVIDEOHDR lpVHdr)
{ …...
I understand that the second parameter in capSetCallbackOnFrame should be a pointer to the callback function, however, I do not understand what I need in addition to “CALLBACK”.
I have tried cast to long* (capSetCallbackOnFrame(m_hWndCAVIFrame,(long*)FrameCallbackProc);) but it did not work and I really do not understand why.
Any constructive help is as always appreciated.
Thanks for your time.
Vaclav
|
|
|
|
|
I'm guessing that your callback function is an ordinary member funcion of CCyView and the API is looking for a global function as a callback. The API doesn't know anything about your class and regular class member functions have the hidden "this" pointer so the signature doesn't match. The API isn't expecting and wouldn't know what to do with a this pointer. You probably need a global function or if you want to encapsulate it in your view class, a static member function.
Once you agree to clans, tribes, governments...you've opted for socialism. The rest is just details.
|
|
|
|
|
Thank you for quick reply.
Yes, I like to use the callback within my class, however, when it is declared as static it won't work with all the parametrs I am currently using as class variables. I guess I need to learn how to use it as global function.
Than I need to copy all the parameters of iterest from the class to global. Right?
|
|
|
|
|
It's a fairly common problem and there are no good solutions that I know of. All leave you feeling their should be a better way but it's what happens when C++ meets the C world. I'd use a static member function just because if you're trying to use a regular member function now, you obviously would like to encapsulate the fuctionality in your class. Also, if you're going to use the result of the callback to affect your view class, making the view instance available to the static member function know the internals. Since it's a view, there's only one instance in an SDI app and hopefully not too many to try to associate in an MDI app.
Once you agree to clans, tribes, governments...you've opted for socialism. The rest is just details.
|
|
|
|
|
Tim, thanks a million for your help. I think I have a better understanding of this callback business now, but I'aint no expert.
I can get to the data via the callback function, so no problem with illegal access to non ststic cariables.
Unfortunatelly I am using clipboard and it is non ststic function and need to resoleve that.
I still do not get how to access the retrun value from the callaback function. If I can get "back " to the class I may be able to continue and get to the clipboard that way, I hope.
Thanks again for all you input
Vaclav
PS. Just figured out that I do not need to copy data to clipboard.
But still would like to know how to access the return valus.
modified on Monday, October 11, 2010 9:35 AM
|
|
|
|
|
For an SDI app, I'd just keep a pointer to the view somewhere the callback function can find it. Then when it gets the data, it can use the view pointer to call methods on the view instance and to its thing. For an SDI app, it's a little tougher if you want multiple views interacting with the callback. If it was the active view you wanted to receive the data, you could keep the pointer updated everytime a view is activated. Not very C++ elegant but it's one solution.
Some APIs that use callbacks help by letting you pass a "magic cookie" which is usually a void pointer and then give it back to you with the data. If you passed the view pointer, you could cast it back inside the callback function and have your way with the associated view. Not type safe but at least it's in a very limited scope.
Once you agree to clans, tribes, governments...you've opted for socialism. The rest is just details.
|
|
|
|
|
Hello Tim,
I just started to work on this and I guess I am doing it kinda backwards.
I was going to copy the data to globlal buffer and I got stuck on how to tell the application the callback is finished.
I am trying to implement windows subclassing to be able to use PostMessage API and my whole program is now hopelesly broken!
Anyway, I like your approach better,I think it is cleaner, but now I just need to finsh typing !!
But I have dsicovered something during our discussion- every AVI application I have seen uses clipboard to get to the data, however, the callback puts the data into buffer!. No more messing around with clipboard, nice and neat!
Thanks.
Vaclav
|
|
|
|
|
Hi all,
I have made a .net application which usees a COM component hosted by a C++ service. The service is a simple C++ service developed using ATL (and not using MFC).
My development environment is Windows XP. Now everything works fine on my dev machine. But when I tried to install my service on a fresh VISTA machine, I could not do so. I got below message:
Activation context generation failed for "C:\Windows\System32\PSPW.exe". Dependent Assembly Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" could not be found. Please use sxstrace.exe for detailed diagnosis.
But when I tried to install my service on VISTA machine which already have Visual Studio 2008, service got installed without any problem.
It means before installing my service on a fresh VISTA (or even fresh Windows 7), I also need to install/copy some other dlls which comes with VS 2008. Can anybody help me in knowing how should I go about it. Or might be my assumption that I need to install/copy some other VS dlls is wrong.
I could not resolve this problem. So seeking for help.
Regards
Aseem
modified on Sunday, October 10, 2010 11:36 PM
|
|
|
|
|
First of all try building a release version. Then when you've done that distribute the "Microsoft Visual C++ 2008 redistributable" (name from memory, might have it slightly wrong) with your service. Either add it to the installation media OR set the installer to download it directly from MS on installation. Personally I bung it on the CD.
Cheers,
Ash
|
|
|
|
|
Hi Ash,
Thanks for your reply. I could fix the problem the way you said.
Thanks and Regards
Aseem Sharma
|
|
|
|
|
Hi,
Can you please instruct me, how to detect if the current computer that is running my app, is part of a local network.
In other words, I just need to know if the computer is a standalone system or is part of a local network system.
Best Regards,
sdancer75
|
|
|
|
|
Not sure what qualifies as "standalone system".
You could check the list of network interfaces and see if you have something else than the loopback IP addresses. As long as no static IP address was assigned, you will be able to detect LAN connections (DHCP server).
Hope this helps...
|
|
|
|
|
Thank you for your reply.
What is the appropriate class for network interface ? The CSocket class I dont think that have member functions to accomplish that.
When I talk about standalone machine, I mean a standard PC without any local network to connect with, but with or without internet connection.
Regards,
sdancer75
|
|
|
|
|
sdancer75 wrote: I mean a standard PC without any local network to connect with, but with or without internet connection.
Not sure how to fullfill your requirement, even a household with a single PC and a (wireless) router uses a local network connection, e.g. 192.168.2.0/24. On Windows, have a look at GetIpAddrTable() or for a quick check run ipconfig from command line.
/M
|
|
|
|
|
Hi,
Yes, you have right, but i was thinking about checking host names like windows do, when you double click on network icon on the desktop, but I dont know where to start looking for.
Windows somehow knows that in the network there are local computers or just dump devices like printers with a network card.
Regards,
sdancer75
|
|
|
|
|
I am not familiar with Windows APIs for service discovery or Microsoft's proprietary networking protocols. Could be worth to ask another forum question and see if someone else can help.
|
|
|
|
|
COleDateTime date = COleDateTime::GetCurrentTime();
CString one_id = "A001";
CString description = "test";
sqlSP.Format("declare @data_uid as integer exec dbo.msp_Insert %s, %s, %d, @doc_uid output select @doc_uid AS doc_uid",
one_id,
description,
date
);
i need to insert a COleDateTime in MFC to a MS SQL table, with column as datetime.
Can anybody tell me what is the error???
I guess there is a CString formatting error...
Any help will be great.
Saleem
|
|
|
|
|
Found a fix....
COleDateTime dateTime = COleDateTime::GetCurrentTime();
double date = dateTime.m_dt;
CString one_id = "A001";
CString description = "test";
sqlSP.Format("declare @data_uid as integer exec dbo.msp_Insert %s, %s, %f, @doc_uid output select @doc_uid AS doc_uid",
one_id,
description,
date
);
|
|
|
|
|
Hi all,
i m using CRecordset to handle access data base.
i retreive the record count by GetRecordCount but its not change after Update.
but it gives same value as i open the recordset.
Ctest* test_sett = new Ctest;
if ( !test_sett->IsOpen() )
test_sett->Open();
test_sett->AddNew();
test_sett->Update();
int ct=test_sett->GetRecordCount();
CString str;
str.Format("%d",ct);
AfxMessageBox(str);
if ( test_sett->IsOpen() )
test_sett->Close();
delete test_sett;
please help me for this.
please tell me how can refresh the record count after inserting the record.
thanks in advance.
|
|
|
|
|
Le@rner wrote: please tell me how can refresh the record count after inserting the record.
See the 'yellow' note here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
i also chk with move last option but problem is still same.
|
|
|
|