|
Hello,
My question is: would it be possible to make a correct screen capture if a video file is playing at that moment ? (not necessarily in full screen)
I saw what are the methods for capturing the screen via d3d but for videos playing the capture consists just in a black square !
Would it be a solution for this?
Thanks.
|
|
|
|
|
hi!
i've written a little template class test app & am having real problems trying to build it. it all compiles fine but i get LNK2019 errors for every method of the template class used in 'main'. i've copied the code & build output below, & would really appreciate ANY help you can give. thanks!!
#ifndef _TEST_H_
#define _TEST_H_
template <class type> class Test
{
public:
void SetMember(type Val);
type GetMember();
Test<type>& Copy();
private:
type m_Member;
};
#endif // _TEST_H_
i've gotta feeling that i've implemented the class methods incorrectly, but really can't see how!?
#include "test.h"
template <class type>
void Test<type>::SetMember(type Val)
{
this->m_Member = Val;
}
template <class type>
type Test<type>::GetMember()
{
return this->m_Member;
}
template <class type>
Test<type>& Test<type>::Copy()
{
return *this;
}
#include <iostream>
#include "test.h"
using namespace std;
int main()
{
Test<int> tst;
cout << "TEMPLATE TEST PROGRAM..." << endl << endl;
tst.SetMember(68);
cout << "TEST CLASS RETURNS\t" << tst.GetMember() << endl;
Test<int> tst2 = tst.Copy();
cout << "TEST CLASS 2 RETURNS\t" << tst2.GetMember() << endl;
cout << "Press any key to end..." << endl;
cin.get();
}
the above code produces the following errors on build...
------ Build started: Project: template_test, Configuration: Debug Win32 ------
Compiling...
test.cpp
Linking...
main.obj : error LNK2019: unresolved external symbol "public: class Test<int> & __thiscall Test<int>::Copy(void)" (?Copy@?$Test@H@@QAEAAV1@XZ) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "public: int __thiscall Test<int>::GetMember(void)" (?GetMember@?$Test@H@@QAEHXZ) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "public: void __thiscall Test<int>::SetMember(int)" (?SetMember@?$Test@H@@QAEXH@Z) referenced in function _main
Debug/template_test.exe : fatal error LNK1120: 3 unresolved externals
template_test - 4 error(s), 0 warning(s)
---------------------- Done ----------------------
Build: 0 succeeded, 1 failed, 0 skipped
|
|
|
|
|
Copy all code of test.cpp at the end of test.h , remove test.cpp from project, and you will be done!
ARSALAN MALIK
|
|
|
|
|
thanks!! that works!! why is that?? i thought when a class is used in more than one module (.cpp) you have to implement class methods etc in a separate cpp!? does the compiler do that for you for every specialisation then??
|
|
|
|
|
I remember a person asking the same thing a couple of days ago... The answer can be found here[^]
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
Hi everyone, i am in the process of writing a virtual keyboard, i have all the functionality in place, but am unable to pass the keystrokes to an underlying program, eg a new mail message. if anyone has any pointer it would be much appreciated.
|
|
|
|
|
SendInput Function -
The SendInput function synthesizes keystrokes, mouse motions, and button clicks.
|
|
|
|
|
I am using the keybd_event method, and it works ok, but only within my program, if i put a text box within my program then the keystrokes are displayed as expected in the box, i need to be able to pass these key strokes to another program, so if i had say notepad open when i press the keys on my virtual keyboard they appear in notepad ???
Lee
|
|
|
|
|
I am having this same problem. I want to send keyboard strokes from my program to other windows applications. How would one go about this problem?
|
|
|
|
|
Hello! I am new to MFC.
I want to change an Edit Box from a function!
The situation is the following (simplified):
<br />
<br />
int function();
<br />
void TestDlg::OnGo()<br />
{<br />
SetDlgItemText(IDC_Output, "From OnGo!!!");
function();
}<br />
<br />
int function()<br />
{<br />
SetDlgItemText(IDC_Output, "From funtion()!!");
}<br />
<br />
So, the output from the function does not work. I know, I have to append something, but what?????
|
|
|
|
|
Try like this from function
CEdit *edit;
edit=(CEdit*)GetDlgItem(IDC_Output);
edit->SetWindowText("From function()!!");
Regards
Alpha
|
|
|
|
|
Doesnt work, GetDlgItem() asks for Window Hande (doesn't accept 1 Parameter)!
How can I get this?
WoodStock
|
|
|
|
|
Their are two versions of GetDlgItem.
1. The SDK version needs two param
2. The CWindow::GetDlgItem and CWnd::GetDlgItem needs 1 param.
Are you getting some compiler errors ?.
Regards
Alpha
|
|
|
|
|
There are two solutions to your problem:
1. Make function() a member of of your TestDlg class.
or,
2. You need to pass handle of dialog window (HWND) to SetDlgItemText as first parameter, in function :
SetDlgItemText(hWnd, IDC_Output, "From funtion()!!");
You may pass this handle to function . This handle is member of TestDlg class with name m_hWnd .
ARSALAN MALIK
|
|
|
|
|
How can I make function() a member of my TestDlg class?????
|
|
|
|
|
You've not shown what the error is. Although it's obvious in this example, it still doesn't hurt to be explicit.
Change function() to:
int TestDlg::function()
{
...
} and don't forget to add the prototype to the class.
Don't use SetDlgItemText() . Use ClassWizard to create a control variable (CEdit in this case) and use the SetWindowText() method to change the text.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I have a volume control prog. downloaded and written the necessary hotkey code lines based on
Beginner's Tutorial - Using global hotkeys
http://www.codeproject.com/system/nishhotkeys01.asp
into it.
The hotkey succesfully registers.
RegisterHotKey(this->m_hWnd, myatom, MOD_CONTROL, VK_UP)
on querying this line I get a true
in the header:
public:
...
LRESULT OnHotKey(WPARAM wParam, LPARAM lParam);
...
DECLARE_MESSAGE_MAP()
in the correspondig cpp file:
BEGIN_MESSAGE_MAP(CVolumeControlDemoDlg, CDialog)
//{{AFX_MSG_MAP(CVolumeControlDemoDlg)
... // some more messages
ON_MESSAGE(WM_HOTKEY,OnHotKey)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
and also in the cpp file:
LRESULT CVolumeControlDemoDlg::OnHotKey(WPARAM wParam, LPARAM lParam)
{
if(wParam == MOD_CONTROL && lParam == VK_UP) {
log.write("!!! HOTKEY PRESSED SUCCESS !!!");
}
return 0;
}
on pressing the hotkey while the prog is running -> NOTHING happens. But if I call the following line in the code I get the WM_HOTKEY message correctly:
SendMessage(WM_HOTKEY, MOD_CONTROL, VK_UP);
What am I doing wrong? Plz in very easy language since I am a programming N00b. TY
|
|
|
|
|
Hi,
I am using InternetGetConnectedState to determine, whether a LAN connection exists.
IBZHTTP_API LRESULT canConnectLAN() {
DWORD dwFlags;
InternetGetConnectedState(&dwFlags,0);
return LRESULT( 0 < (dwFlags & INTERNET_CONNECTION_LAN) );
}
I tested this function on two computers(PC1, PC2), both connected to the same LAN. Both have additionally RAS installed and a proxy exists. The LAN connections are activated.
PC1: Return value dwFlags is 56, which is correct, it means
INTERNET_CONNECTION_LAN (0x02)
INTERNET_CONNECTION_PROXY (0x04)
INTERNET_RAS_INSTALLED (0x10)
INTERNET_CONNECTION_CONFIGURED (0x40)
PC2: Return value dwFlags is 50 which is not enough, it means only
INTERNET_RAS_INSTALLED (0x10)
INTERNET_CONNECTION_CONFIGURED (0x40)
When RAS connections with modem are defined on PC2, dwFlags is correct with respect to RAS, 51:
INTERNET_CONNECTION_MODEM (0x01)
INTERNET_RAS_INSTALLED (0x10)
INTERNET_CONNECTION_CONFIGURED (0x40)
What could be the reason, that InternetGetConnectedState does not report the LAN connection on PC2?
Thank you
Werner
|
|
|
|
|
Hi,
I have an application which accesses an archive file. And my application is multi instance application. When I open an archive file in the first instance of the application then I Should lock that archive file so that when I try to open the same archive file (which is locked in the first instance) in the second instance of the application then application should give error or throw an exception.
Plz, help me in this.
Any adea/code sample?
Thanks & Regards,
Neeraj
|
|
|
|
|
Hi Neeraj,
Use CFile::shareDenyRead,CFile::shareDenyWrite, or CFile::shareExclusive as a nOpenFlags for Open function.
Regards
Alpha
|
|
|
|
|
Thanx Alpha.
The use of CFile::shareDenyRead,CFile::shareDenyWrite, or CFile::shareExclusive flags will help when two users/processes are trying to acess the same file at the same time.
But in my application I open a file in the first instance of application and and I close it(Here after opening file I should lock the file). Unless I unlock that file (which I lock in first instance) OS should not allow to open by other process/other instance of application.
Thanks & Regards,
Neeraj
|
|
|
|
|
You can use LockRange function for this and use UnlockRange whenever you want to Unlock this.
Regards
Alpha
|
|
|
|
|
If you are denying read/write access to the file when it is opened, why do you need to bother with locking?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanx David.
But,I am using the wordspace file in my application. Here I open the file, read it and close it. Again I open the file, write to it and close it. It is several times.
What I need is one perticular workspace file can be accessed by only one instance of the application. i.e. I should not be able to work on the same workspace file from two different instance of the same application.
When I access the workspace file in first instance, all the data is copied to the application variables. When I save, the variable data is written back to workspace file. This happens several times.
While working on this workspace if I open the one more instance of the same application and start working on the same workspace file then there will be data mismatch/data loss etc. This should not happen.
So, when I access a workspace file from one instance of application then I should lock that file so that one more instanct of application should not able to access that file unless I unlock that workspace file.
How to do this?
Thanks & Regards,
Neeraj
|
|
|
|
|
If you open the file using the CFile::shareDenyxxx flags, that should allow the file to be opened only once. Does that not work for you?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|