我有一个用c ++和chrome扩展编写的本机应用程序.
我正在使用"chrome native messaging"在它们之间进行通信.
Native-App代码:
int main(int argc, char* argv[]) {
unsigned int a, c, i, t=0;
std::string inp; do {
inp="";
t=0;
// Sum the first 4 chars from stdin (the length of the message passed).
for (i = 0; i <= 3; i++) {
t += getchar();
}
// Loop getchar to pull in the message until we reach the total
// length provided.
for (i=0; i < t; i++) {
c = getchar();
inp += c; …
Run Code Online (Sandbox Code Playgroud) c c++ google-chrome google-chrome-extension chrome-native-messaging
HBITMAP g_startcapBitmap = NULL, g_stopcapBitmap= NULL;
int nScreenWidth, ntWinx;
enum {ID_BUTTON_START=1,ID_BUTTON_STOP}; //constants for buttons
/*
* Message loop handler for the notification window.
*/
LRESULT CALLBACK myWndProcedure(HWND hWnd, UINT Msg,
WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
std::string json;
switch(Msg)
{
case WM_CREATE:
buttonStart = CreateWindowEx(WS_EX_TOPMOST,L"Button",L"START CAPTURE",BS_PUSHBUTTON | BS_BITMAP | WS_CHILD | WS_VISIBLE ,10,1,180,30,hWnd,(HMENU)ID_BUTTON_START,NULL,0);
g_startcapBitmap = (HBITMAP)::LoadImage(GetModuleHandle(NULL),
//L"StartCaptureWhite.bmp",
MAKEINTRESOURCE(IDB_BITMAP1),
IMAGE_BITMAP,
180,
30,
LR_DEFAULTCOLOR);
if(g_startcapBitmap == NULL)
LOG_INFO("loading startbitmap failed...!");
if( ::SendMessage(buttonStart, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)g_startcapBitmap) == 0)
LOG_INFO("sendimage for …
Run Code Online (Sandbox Code Playgroud)