|
No sorry, I am not a COM expert. The solution I have found seems only to work with RTF text and embedded objects like graphics. I don't know what you have to do if you want to paste OLE objects like graphics etc. and I have found no additional information.
I think you must do much more OLE stuff if you want to paste OLE objects, but I have absolutely no idea how you can do this. Maybe you should post in the COM/OLE fourm, too.
It would be very nice if you post your efforts in this thread, since I am also interested in this subject.
|
|
|
|
|
Here are some additional issues which may help you:
* The GetIRichEditOle method of the CRichEditCtrl class returns an IRichEditOle pointer. This may be useful, but the documentation is very thin.
* Take a look in the source code of the CRichEditView class. You can find the source code in the installing directory of your Visual Studio installation. CRichEditView is a wrapper for CRichEditCtrl so it may contain the solution for your problem, because I think it can paste graphics!
|
|
|
|
|
I must do this in a Rich edit control. I am almost desperately. Can you help me? I don't know if I can post this because I'm doing this for a company.I know about RichEditView.
|
|
|
|
|
I know that this subject is very ugly. I have spent 1 week until I have found this minimal solution. Since pasting RTF text with embedded objects was good enough for me I have stopped looking for other solutions. So this is all I can offer you...
I have not found any further informaion about this topic.
The 2 tipps are only subjects where I would take a look at.
And I don't want your complete code, I only wanted to say that you may post here, if you find a solution for the problem somewhere in the internet
|
|
|
|
|
OK, but do you have any idea why my app does not copy images from Word?
|
|
|
|
|
What about pasting metafiles, the format is CF_METAFILE.
|
|
|
|
|
Hi all,
I need to programmatically (C/VC++) authenticate the credentials of a user which is on a remote machine. The machines (Win2000 Servers) are connected through LAN. The user is only local to the remote machine and not a domain user. Also, the user is a member of "Users" group (or it may belong to any group). I will use only IP address and not the DNS for connecting to the remote machine. I don't want to authenticate over the Internet. I tried the following approaches:
1) Using SSPI functions such as "GenClientContext", "AcquireCredentialsHandle", etc., which involves preparing client and server messages to negotiate, challenge and authenticate. But this works fine only for local users and domain users.
2) Mapping of a drive from remote machine. But this fails for certain conditions (e.g., when the logged-on credentials are same for both the machines)
3) Changing the password to the same value using NetUserChangePassword. But this fails if password policy restricts.
Is there any other way to authenticate the remote user credentials?
Bose Dayala
|
|
|
|
|
Dear All,
I am developing an applicaton in windows2000 using MFC VC++6.0
Can you suggest a way out in the following matter:
I have a dialog application A which calls another dialog application B on click of the button.
Once the dialog window of B is created the application b is activated ,but I want to bring back the focus on the previous application window.(i want to activate the app a once the b is created)
i.e
MFC App A ----> Click of button --CALLS---> Another MFC App B
(Both are in running state, but the focus gets shifted to application B)
Do let me know if you need futher clarification of the question.
Regards,
Rohit
|
|
|
|
|
Use WM_SETFOCUS Windows message. Send it from app B's window to app A's window. Unfortunately, as you use two seperate applications, they cannot converse by regular pointer-means. You need to search for the dialog window and grant it focus.
You could, alternatively, start the app B as minimized. This can be specified by the STARTUPINFO structure of the CreateProcess call. If it is started up as minimized, it doesn't get the focus. Then, you can create a seperate function into app A that will show and activate B's window as needed. See CreateProcess in MSDN for more information.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Thanx again to the ones that helped me last time. Now what I'm working on is something quite a bit more complex(err I think so). What I would like is the following: When a priticular button is clicked I want it to either change the dialog to a different look or open a different dialog window and not allow acess to the other. And how possible is it to create something like a database(I dont' think I really need one but)with out making a database. To further clearify I would like to refernce a name to a PIN(something really easy). If that is to hard just say so. Thanx for your help and time.
|
|
|
|
|
Hi,
Here iam trying to capture the screen , i included d3dx8tex.lib, d3d8 in the project. Iam using Vc++ 6.0 and DirectX 9.
In my dailog box when i click on button (Screen button) trying to capture the screen.
In run time when i click on the button iam getting an error, can any body tell me what is the problem or is there any other solution using DirectX
#include <d3dx8tex.h>
#include <d3d8.h>
typedef struct IDirect3DDevice8 *LPDIRECT3DDEVICE8, *PDIRECT3DDEVICE8;
typedef struct IDirect3DSurface8 *LPDIRECT3DSURFACE8, *PDIRECT3DSURFACE8;
void CMainclass::OnScreen()
{
LPDIRECT3DDEVICE8 pDevice ;
LPDIRECT3DSURFACE8 pSurface ;
LPDIRECT3DSURFACE8 pFrontSurface = NULL;
pDevice->GetFrontBuffer( pSurface ); //Here iam getting error
D3DXSaveSurfaceToFile( "ScreenShot.bmp", D3DXIFF_BMP, pFrontSurface, NULL, NULL );
}
Thanks in Advance
Santosh
|
|
|
|
|
First off, what error are you getting?!
There is another soulition, Call GetDC(NULL) to get a device context to the "desktop" window (ie the entire screen). This DC will have a bitmap selected into it that represents the screen, all you need to do is pull the bitmap out, and save it to a file.
|
|
|
|
|
Im reading "teach yourself C++ in 21 days", well Ive been stuck on day 6 for about a week now. Can anyone tell me whats wrong with this source? I keep getting overloaded function errors but I really want to understand this before I move on to day 7. thanks
/*
Chapter 6 end of lesson program
Teach yourself C++ in 21 days
*/
// simple program to test my knowlege of classes...
// make a class that assignes and reads values using public accessors
#include <iostream.h>
class Employee
{
public:
int GetAge() const;
void SetAge(int age);
int GetYearsOfService() const;
void SetYearsOfService(int yearsOfService) const; //Public accessors so that the variables can remain private
int GetSalary() const;
void SetSalary(int salary);
private:
int age;
int yearsOfService; //Private variables
int salary;
};
int Employee::GetAge()
{
return age;
}
void Employee::SetAge(int age2)
{
age = age2;
}
int Employee::GetYearsOfService()
{
return yearsOfService;
}
void Employee::SetYearsOfService(int yearsOfService2)
{
yearsOfService = yearsOfService2
}
int Employee::GetSalary()
{
return salary;
}
void Employee::SetSalary(int salary2)
{
salary = salary2;
}
void main()
{
int age2, yearsOfService2, salary2;
Employee Matt; //define 2 objects of class employee
Employee Max;
Matt.SetAge(21);
Max.SetAge(35);
Matt.SetYearsOfService(2); //assign values to the 2 objects
Max.SetYearsOfService(6);
Matt.SetSalary(20000);
Max.SetSalary(34600);
cout<<"Matts age is : ";
cout<<Matt.GetAge() <<"\n";
cout<<"Maxs age is : ";
cout<<Max.GetAge() <<"\n";
cout<<"Matts salary is : ";
cout<<Matt.GetSalary() <<"\n"; //output the above values
cout<<"Maxs salary is : ";
cout<<Max.GetSalary() <<"\n";
cout<<"Matts years of service is : ";
cout<<Matt.GetYearsOfService() <<"\n";
cout<<"Maxs years of service is : ";
cout<<Max.GetYearsOfService() <<"\n";
}
thanks for any help or advice
|
|
|
|
|
1) Overloaded function errors due to missing const qualifier in function definitions
When you declare a member function constant, the const qualifier is also required in the function definition (and declaration). For example,
class Employee
{
...
int GetAge() const;
...
};
int Employee::GetAge() const{
return age;
}
2) Don't declare SetYearsOfService() as a constant member function (leave off the const at the end)
3) Missing ; in SetYearsOfService()
void Employee::SetYearsOfService(int YearsOfService2)
{
yearsOfService=yearsOfService2;
}
|
|
|
|
|
thanks, I feel the headache going away already
|
|
|
|
|
like a file browser, my tree control has two kind of item : folder and file. But ctreectrl just supply one method to sort all items.
please show me the way that just sort the folder or just sort the file item...
thanks...
|
|
|
|
|
You need to determine while sorting that the item is file of a folder for that you use lparam of the TVITEM to store that information.
Then its a matter of logic.
here is the logic.
if(item1 is file && item2 is file)
do the sorting.
if(item1 is folder && item2 is folder2)
do the sorting.
if((item1 is folder && item2 is file) || (item1 is file && item2 is folder))
return the value that will determine wheather the files should be at the top.
Toughest Steel Comes From Hottest Furnance
|
|
|
|
|
Im trying to get the item details of a CListCtrl m_lst1.
Using the foloowing code...
only that im not getting any result
any suggestions
-------------------------//--
char szLabel[256];
NMLVDISPINFO NMLVDispInfo;
ZeroMemory(&NMLVDispInfo.item, sizeof(LVITEM));
NMLVDispInfo.hdr.code = LVN_GETDISPINFO;
NMLVDispInfo.hdr.hwndFrom = AfxGetMainWnd()->m_hWnd;
NMLVDispInfo.hdr.idFrom = AfxGetMainWnd()->GetDlgCtrlID();
NMLVDispInfo.item.iItem = 1;
NMLVDispInfo.item.mask = LVIF_DI_SETITEM| LVIF_TEXT;
NMLVDispInfo.item.pszText = szLabel;
NMLVDispInfo.item.cchTextMax = 255;
m_lst1.SendMessage(WM_NOTIFY, (WPARAM)NMLVDispInfo.hdr.hwndFrom, (LPARAM)(LPNMHDR) &NMLVDispInfo);
-------------------------//--
|
|
|
|
|
fordge wrote:
NMLVDISPINFO NMLVDispInfo;
ZeroMemory(&NMLVDispInfo.item, sizeof(LVITEM));
Not that I'm providing any help with your problem at hand, but since you are using C++ you should be aware you can do:
NMLVDISPINFO NMLVDispInfo = { 0 };
To zero-initialize the struct.
That your code fills the struct with zeros based on the size of a completely unrelated struct (the boldface parts) also displays this technique could help create less buggy programs.
|
|
|
|
|
If i create window dialog base to do interfacing. In side the dialog base i got 2 button to control the on and off function.And 4 radio button to control the dc motor speed consist of three radio button control speed in low,medium and high and another one radio button to control the stop of operate dc motor. Actually i have two set consist of 4 radio button just now i mention as above.... Total got 2 button and 8 radio button!!!
Anyone can explain for how many data port,control port or status i need on the parallel port?
|
|
|
|
|
First of all, to get you started, here is the pin designation[^] of an SPP (Standard Pareller Port) mode LPT.
As you can see from the schematic, by utilizing the DATA port, you are granted access to 8 bits of control information summing up to a total of 256 control possibilities.
Now, your task is to design the logic on how the motor is driven. The LPT can supply +5 V from each pin, and the maximum current is limited by the power source of the computer. As such, it is recommended to use the pin outputs only for TTL-level logic control. Consider the following example, with pins D0 - D7 being the data pins, and D0 being the least significant bit.
D7 D0 DEC
0 0 0 0 0 0 0 1 = 1 = Stop motor
0 0 0 0 0 0 1 1 = 3 = Low drive
0 0 0 0 0 1 1 1 = 5 = Medium drive
0 0 0 0 1 1 1 1 = 7 = High drive If this was your logic diagram, then you would require a 3-bit D/A converter to convert the digital word into analogue voltage. The idea is that you first have an on/off switch controlled purely by D0. Then, D1 - D3 are bridged into controlling an OP-AMP to do the conversion. You can find an example of a simple 3-bit DA-converter from this page[^].
As for the actual port control, in the IBM standard, the pareller port can be found from the IO space at address 0x378. Here[^] is a small example on how to write and read data from a pareller port under Microsoft Visual Studio. Note, however, that this method might not work under Windows 2000/NT/XP because their driver architecture is a bit different. See this article[^] under the CodeProject->System->Hardware programming.
Happy interfacing
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
If i use the logic circuit just u mention above but how the D/A converter can control the speed of dc motor? D/A converter can stand alone to control motor speed or need aid from the software!!!!
Thank You
|
|
|
|
|
The D/A converter cannot run the DC motor alone; it needs input signals to determine the output. These input signals (TTL-level) are provided by the pareller port's pins.
I won't start explaining in detail how the converter works here, that's a job for an electronics teacher. Instead, in a glance, let's say that the converter is able to convert a digital word into an analogue signal: the amplitude of the signal is determined by the digital input.
So, in the logic example, we had three digital pins, D1-D3. If you have a maximum input of +12 V DC for the converter, then an input of 111 would cause it to output +12V. The other levels of voltage can be directly calculated.
This means that depending on the output of the digital pins, the DC motor is fed with more voltage, thus resulting in greater RPM of the rotor. However, as I do not know how the motor is constructed, this might not be the correct approach. Some motors have seperate input pins for seperate drive levels, for example, feeding it 5V + 5V + 5V would result in full speed, where as 0V + 5V + 5V would stand for medium level drive. You must consult the motor's documentation and schematics for these details.
The basic idea is that whatever the way in which the motor is controlled, you MUST have some-sort of a voltage-level seperation between the pareller port and the motor. This means that you cannot feed the inputs of the motor from the pins directly. Doing so would break the port most certainly, and might even damage your computer seriously.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
To control the motor at high speed parallel port need to send the 0000 0111 to the converter. So i facing the another problem bcos parallel port is limited output port. When i want to control two set of the fan i not has enough output from the parallel port.... Actually i found the converter circuitry but this converter need 8 data port operate!!!
Thank You
|
|
|
|
|
deven chin wrote:
To control the motor at high speed parallel port need to send the 0000 0111 to the converter
Correct.
deven chin wrote:
When i want to control two set of the fan i not has enough output from the parallel port
Incorrect. You must have an ACTIVE D/A CONVERTER between the port and the motor. This means, in english, that all output power (voltage or current) from the converter comes from a different power source, such as a 12 V battery. You do not feed the motor directly with the power outputted from the pareller port, as this power amount is NOT ENOUGH, and taking out too much power (voltage or current) from the port will break it, and possibly even damage your motherboard.
Having an 8-bit output allows you to have a total of 256 different voltage levels, including no voltage. If you split it to half, 4-bit & 4-bit, you can still get up to 16 voltage levels. Heck, you could even split these two in half, having four 2-bit digital outputs, with each having a possible number of 4 voltage levels. Voltages like +0V, +4V, +8V and +12V, for example, depending on the bit sequence of the two bits. This would allow you, with 4 D/A converters, control up to four DC motors independently. I think that is more than enough.
So, once more: get yourself the schematics of a R2-2 D/A converter that utilizes an operational amplifier. If you have no other way, contact the local electronics shop and ask them for information. Tell them that you need an OP-AMP based D/A converter, they should understand. I won't start designing the schematic or the output control for you, because I don't do that kind of stuff free-of-charge.
If there is still something more you do not figure out, then place the question. But please, next time you write, do a complete grammar and typo-check on your post, and do not use abbreviations, no matter how busy you were. It is much easier to answer your posts when they are readable and easy to understand. Currently, your posts are pretty far from that.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|