Visual C++ :: Create NPAPI Plugin?
Jul 28, 2014Is it possible to create an NPAPI Plugin in VC++, that is cross browser compatible or should atleast work in Chrome Browser?
View 1 RepliesIs it possible to create an NPAPI Plugin in VC++, that is cross browser compatible or should atleast work in Chrome Browser?
View 1 RepliesThis is the problem in detail:
I have a VC++ project to create a DLL that will be used as a Plug-in in an external programm. This DLL uses some MFC functions. The initial configuration of the project was:
-Use of MFC: Use MFC in a Static Library
-Common Language Runtime support: No Common Language Runtime support
-Runtime Library: Multi-threaded Debug (/MTd)
This configuration worked fine, there were no compilation errors and the resulting DLL worked correctly.
The problem came when it was necessary to add to the DLL some functions of .NET, using the namespace System and similar. To do that, I had to change the Common Language Runtime support, to Common Language Runtime Support (/clr). Then, when I tried to compile, I got this message:
'/MTd' and '/clr' command-line options are incompatible
So I changed the Runtime Library to Multi-threaded Debug DLL (/MDd). Then I got this error message:
Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version
So I also changed the Use of MFC to Use MFC in a Shared DLL.
After this, the compilation was correct. Then logically the size of the generated DLL is smaller, but this new DLL does not work correctly, the external program in which this DLL is used crashes.
I don't know what to do to fix the problem. Maybe I need to add some other DLLs or files to the directory where the DLL is located, where the external program uses it. But I would prefer to include a single DLL file, but this seems to be incompatible with the use of .NET functionality.
I want to create a plugin with c++ which will be supported by all Browser,i am stuck how to start.
View 2 Replies View RelatedI'm looking at writing my own plug-in app, but I know that deleting class instances that were created in a plug-in module can result in the dreaded "undefined behaviour" because of the different memory spaces. Many examples of plug-ins use create_class and destroy_class functions to resolve this problem, but I wondered about overriding / overloading the class's new and delete operators. This would be used for all third-party library class derivations (e.g. derived GUI classes) and all home-grown classes.
The operators would only be declared in the class declaration:
class PluginBase {
public:
void *operator new(std::size_t n);
void operator delete(void *p);
// Other plugin bits
While the actual implementation would be defined in the plug-in's implementation file:
#include "PluginBase.h"
void *PluginBase::operator new(std::size_t n) {
return ::operator new(n);
[Cvoid PluginBase::operator delete(void *p) {
return ::operator delete(p);
}
This would need to be implemented in every transferable plug-in class (possibly by a crafty IMPLEMENT_PLUGIN(classname) macro or some other mechanism), but before I commit this to my code I was hoping for feedback. Does this sound like a good idea? The GUI classes in particular are handled by a third-party library, so it's some memory-space safe way of deleting them by the GUI library (in the app) that I'm looking for.
So I'm trying to accomplish something that right seems to hard for it to be worth it. I'm trying to write a plugin framework/system for my game. I have read about it and everything that pops up says it's OS-specific and you have to load the plugins from either a .so file on linux or from a .dll file on Windows. So here lie my questions:
-Is there any universal way of accomplishing this?
-Every way I've seen assumes i know the names of the functions I'm calling which doesn't hold true if the plugin are written by a 3rd party. How would i turn the table on this matter?
I am trying to create a OCX from a C++ dll., Here's the scenario I have a C++ dll and this dll needs to be called in VB.net program my boss want's me to create an OCX out of this.
C++ dll and use it in a VB.net class library, apparently I have created an OCX but it requires a form but the VB.net program is a class library.
I'm trying to create a simple webbrowser at my app.
code sample:
....
ATL::CAxWindow m_wndContainer;
ATL::CComPtr<IWebBrowser2> m_spWebBrowser;
HWND hWnd = m_wndContainer.Create(NULL,
CRect(0,0,200,100),
(LPCTSTR)0,
WS_CAPTION|WS_THICKFRAME|WS_OVERLAPPED|WS_MINIMIZEBOX|WS_MAXIMIZEBOX);
CoCreateInstance(CLSID_WebBrowser,NULL,CLSCTX_INPROC,IID_IWebBrowser2,(void**) &m_spWebBrowser);
...
everything is work fine except the fact the it seems that it create an IE version 7.0 and my machine have IE 8 installed.
it not suppose to create the IE according to my installed version?how do i suppose to do it?
How can I create a dialog as a DLL ? I have a SDI MFC app (CView is based on CFormView) and from a button I want to load a modal dialog, but that dialog must be developed as DLL ... I didn't find something that fit my needs on internet ... P.S. I have only VC6 !
View 14 Replies View Relatedhow to create a new toolbar with my icons in vc++?
View 3 Replies View Relatedhow to create, initialize, and maintain a memory device context that works as a local buffer for images? The idea is to maintain some large images in local DCs and bitmaps, and only bitblt them to screen in OnDraw().
What I did so far was was to define CDC and CBitmap objects as members of my View class, and then tried to initialize them with the sequence that begins at "// Initialize buffer". I placed that sequence in either OnInitialUpdate, or PreCreateWindow, or OnPrepareDC, or the view constructor, to no avail. The code always crashes in OnDraw, and I've noticed that the m_hDC member of myDevice is zero at that point.
Obviously, the initialization is wrong and MFC does (too many) things in the background which I'm not aware of.... My question was where can I read about that?
Code:
class CMyView : public CScrollView {
// ...
CDC myDevice;
CBitmap bmp;
CBitmap *oldbmp;
[Code] .....
How can I create MS Word 'print layout' like interface. The attached picture says it all. Basically I want a shaded area around my document just like word so it gives a feel of the 'page'.
I was hoping I can override some function somewhere and along that lines tried playing around with below but that didn't work.
Code:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) {
if( !CFrameWndEx::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.cx = 250; // just playing around with size
cs.cy = 250;
return TRUE;
}
How can I do that?
I want to create a basic window using visual c++ 2010 express.
View 1 Replies View RelatedHow can I implement the paradigm demonstrated by the code below to run on WinXP?
I want to fork a process or create a thread that shares global variables with the parent process/thread.
The child process/thread monitors the progress of the parent process/thread.
I cannot find documentation for a fork function per se, a Unix term. It might be called something different for WinXP.
I would be happy to use threads instead. But I'm rusty even with Unix application threads; and I know nothing of WinXP application threads.
So any turnkey implementation that demonstrates the simplest use of process or thread functions for my purpose demonstrated below.
In either case, do "forked" processes and threads share global address space in WinXP, as they do in Unix?
I would prefer to avoid the overhead of IPC mechanisms. The "overhead" includes my own relearning curve.
The GUI screwed up my indentation. I would try to correct it. But the proper indentation appears when I edit the posting. I suppose I need to insert real tabs. Haven't figured out how (yet).
Not even real tabs work; and I cannot get the "paste as text" button to behave as I expect. What is the trick for posting indented text in this GUI?
#include "stdafx.h"
#include <stdlib.h>
#include <Windows.h>
long curCount;
int isRunning;
int _tmain(int argc, char* argv[]) {
curCount = 0;
isRunning = 1;
[code]....
I am wokring on a project that has used an MFC DLL in conjunction with Outlook to send and archive mail. I need to be able to create folders for integration from an older mail system. I have looked online to see if there are examples in C++ (since I have to modify the existing C++ dll to include the funcitonality). I realize it is much simpler using VBA or C#, but I am limited with my choice. I essentially want to use the MFC type lib for Outlook 14 and use the CMAPIFolder,CFolders create folders in the Inbox.
here is a sample of the code:
//I have included the necessary header files
COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
//start outlook
if (!olApp.CreateDispatch(_T("Outlook.Application"), &e))
[Code]....
I compiled the source code of QT5.1 to work with Visual Studio 2010.
But it always start off with a win32 project, so that I need to change the settings every time.
How do I kick start with a x64 project by default?
I'm trying to create an edit box in a CView.So far, this is how far I've gotten:
With this code
Code:
// .h
CEdit m_MyEditField;
// .c
m_MyEditField.Create(WS_CHILD | WS_VISIBLE,CRect(40,40,500,Y+55),this,0x1552);
m_MyEditField.SetWindowText("this is my CEdit field");
As you can see, the edit box doesn't look like the ones in a dialog, which is what I'm trying to accomplish.
Is there possibly some other class I should be using for the edit box?Or another setting for .Create?
C-> Visual studio 2010-> windows 7
How to create a directory / folder.( to browse/save my files to a directory.) how to specify the path?
I googled , but i cant able to find appropriate as it is showing all in the C#, C++ , objective C. But not in C.
Here i am writing a sample program to my POS device .problem here is it is not taking mkdir(direct/dir.h header file)function. Any alternative is there to make a directory?
I have a text file which consist of several values. These values represent distance from origin to any point in the triangle. How can I create histogram from these values? Is there any functions in OpenCV which can create histogram from these values? Below my sample values are given:
..........................
3.4 1.2 6.9 0.2 5.1 2.9
........................
I have a MFC Com Dll that has a CDialog. In the OnCreate event I create an ActiveX control. The dll is hosted inside an executable of mine. In this scenario everything works fine!
The dll is also called from an external executable and then a Debug Assertion in OCCSITE.cpp occurs when I create the ActiveX control. I suspect that in the executable there is no AfxOleInit. I spend some time with this problem and tried to CoInitialize, OleInitialize, AfxOleInitModule and even AfxOleInit in the dll. But all that does not change a thing. If I understand the mechanics then this is an intended behaviour and should be done in the host exe.
What I observed in the OCCSITE.cpp:
Code:
_AFX_THREAD_STATE* pState = AfxGetThreadState();
if (!pState->m_bNeedTerm && !AfxOleInit())
return hr;
In my executable m_bNeedTerm is 0 and in the external one (where the ActiveX does not work) it is -1. In AfxOleInit this is explained as a special flag to prevent the dll from doing an unnecessary OleInitialize. But as I said even if I call OleInitialize myself I get the Debug Assertion and the ActiveX is not visible.
Is there anything I can do to make the ActiveX control work in the external application? Obviously I cannot Change anything in the application...
Is there an easy way to create a column of buttons ina listView?
I need that every file of the listView has a button in the first cell. Is that possible?
I need to create a function using rot to encrypt certain strings the function begins like this
#include "encrypt.h"
std::string encrypt (std::string text, int rot) {
for (int i
and ends like this
return NULL;
}
dont need to write the string encrypted and dont need to crate a decrypt function.
Is it possible to create property which I can pass parameters? Here is what I would like to do:
__property double a = {read=getA("a"), write=setA("a")};
__property double b= {read=getB("c"), write=setB("c")};
double getA(char *a);
void setA(double value, char *a);
double getB(char *a);
void setB(double value, char*a);
I'm digging an old project and i can't switch to a newer visual studio.
I want to plot float data array during debug.
I know some IDE's have such option. There is a separate window in which we can plot data.
Can I write such plugin for Visual Studio 6.0 using visual studio SDK?
Does it support 6.0 version?
An ImageList_Create() function (see here) takes 2 parameters: cx and cy which are the width and height of each image.
Everything is good if I know in advance what size my images will have. But what if I don't?
Let's say I select 32x32 and my images are sized as 16x16. What will happen with the image list? Or my images are 48x48 and the image list should grow to accomodate the extra space. Since on Windows image list is just one big bitmap, will the height of the image list shrink/grow to 16/48 or not? Is there a way to test such behavior?
The problem I'm having is to check whether the actual images will be truncated when they are bigger that the image list initial size or not or whether I will see some extra space if the images are smaller.
The closest way I see is this function, but I am not sure its the right one to apply to the image list itself and not to the image inside the list.
How to test this properly and reliably on Windows XP+?
The code below is suppose to create directories and upload files, but it is not working. What can I do to make the code work?
Code:
void CRECURSIONDlg::Recursion(CString sPath) {
hInternet = InternetOpen(TEXT("BEAR FTP"),
INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
// Make sure there are no errors
hIConnect = InternetConnect(hInternet,"192.168.1.4", 211,
"******", "*****", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0);
[Code] ....
I am reading from a text file and want to create a program that will perform the same calculation for every oscillation.
The text file I'm reading from is attached to this post. A3.txt
The program that I've written is as follows:
Code:
#include <iostream>
#include <fstream>
using namespace std;
int main() {
ifstream inFile ("AP1.txt");
ofstream results_file ("APDuration.txt");
[Code]...
Where I'm having trouble is in having the inFile.seekg function iterate to the next series of values.
Here is what the data file looks like in a graph:
In a nutshell, my program will read the duration of each action potential from a point called "dVmax" (where the upstroke is at its maximum upward rate of change) to the point of 90% repolarization (on the downstroke where 90% of the total wave amplitude is subtracted from the volts at peak amplitude).
If you would like to test my program on one action potential, here is one action potential : AP1.txt