Quantcast
Channel: General Windows Desktop Development Issues forum
Viewing all 6180 articles
Browse latest View live

PrintWindow and MS Edge

$
0
0
Hi,

we have a problem with the PrintWindow funciton on Windows 10 (build 10166). When we call PrintWindow (https://msdn.microsoft.com/ru-ru/library/windows/desktop/dd162869(v=vs.85).aspx) to get a screenshot of the Edge (Project Spartan) browser window we get a black image.
What the reason of this and will it be fixed?

Windows Forms and UAC

$
0
0

have a simple winforms program that is catching computer lock and unlock events and sending info to a remote database. I'm using a directory searcher for basic read operations of the AD. I'm also using System.Enviornment to get the username and computer name.

I have my maifest file set to asInvoker.

What is causing UAC to trigger?

I'm currently coding with C#, VS2013, and .net 4.5

Thanks!

Where to store per-user configuration files?

$
0
0

Hello all.

My application has the need to store a per-user configuration file. This file will be programmatically read and modified by the application at runtime in response to the users actions. I cannot assume my users will have admin privileges. In addition, I plan to make use of Microsoft's "Project Centennial" bridge when it becomes available so that the application can be packaged as a UWA and sold on the Windows Store. It was my intention to use the "System.Environment.SpecialFolder.ApplicationData" location for my application's configuration file by I believe this will cause a UAC notification and according to Microsoft that will disqualify it from Project C submission. Can anyone recommend a way forward? Thanks in advance.

-L

File System Tree Vie1

$
0
0

Hi,

i have build an sample application File System Tree Vie1 in Visual Studio Community 2015 RC. How can I create an application-file with exe-Extension? Thank you for any help.

what service is supporting powershell's http listener mode

Renaming Network Connection fails in Windows 10

$
0
0

Hi, I have written some C++ code to automatically rename the Network Connection in ncpa.cpl. It works fine on Win7 and Win8 but fails in Win10. The function I used is INetConnection::Rename, its return value is 0x80071a90, which means:

HRESULT_FROM_WIN32(ERROR_TRANSACTIONAL_CONFLICT) : The function attempted to use a name that is reserved for use by another transaction. 

But the new connection name I used is something like "Npcap Loopback Adapter", which doesn't seem to be a "reserved" name for Windows. So I wonder what's wrong with this function call in Windows 10? Thanks.

My code is:

/*++

Copyright (c) Nmap.org.  All rights reserved.

Module Name:

    LoopbackRename.cpp

Abstract:

    This is used for enumerating our "Npcap Loopback Adapter" using NetCfg API, if found, we changed its name from "Ethernet X" to "Npcap Loopback Adapter".
    Also, we need to make a flag in registry to let the Npcap driver know that "this adapter is ours", so send the loopback traffic to it.

This code is modified based on example: https://msdn.microsoft.com/en-us/library/windows/desktop/aa364686.aspx
--*/

#pragma warning(disable: 4311 4312)

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <objbase.h>
#include <netcon.h>
#include <stdio.h>

#include "LoopbackRename.h"

#pragma comment(lib, "ole32.lib")
#pragma comment(lib, "oleaut32.lib")

#define			NPCAP_LOOPBACK_INTERFACE_NAME			NPF_DRIVER_NAME_NORMAL_WIDECHAR L" Loopback Adapter11"
#define			BUF_SIZE								255

BOOL DoTheWork(INetSharingManager *pNSM, wchar_t strDeviceName[])
{   // add a port mapping to every firewalled or shared connection
	BOOL bFound = FALSE;
	INetSharingEveryConnectionCollection * pNSECC = NULL;
	HRESULT hr = pNSM->get_EnumEveryConnection (&pNSECC);
	if (!pNSECC)
		wprintf (L"failed to get EveryConnectionCollection!\r\n");
	else {

		// enumerate connections
		IEnumVARIANT * pEV = NULL;
		IUnknown * pUnk = NULL;
		hr = pNSECC->get__NewEnum (&pUnk);
		if (pUnk) {
			hr = pUnk->QueryInterface (__uuidof(IEnumVARIANT),
				(void**)&pEV);
			pUnk->Release();
		}
		if (pEV) {
			VARIANT v;
			VariantInit (&v);

			while ((S_OK == pEV->Next (1, &v, NULL)) && (bFound == FALSE)) {
				if (V_VT (&v) == VT_UNKNOWN) {
					INetConnection * pNC = NULL;
					V_UNKNOWN (&v)->QueryInterface (__uuidof(INetConnection),
						(void**)&pNC);
					if (pNC) {
						NETCON_PROPERTIES *pNETCON_PROPERTIES;
						pNC->GetProperties(&pNETCON_PROPERTIES);

						wchar_t currentGUID[BUF_SIZE];
						GUID guid = pNETCON_PROPERTIES->guidId;
						wsprintf(currentGUID, L"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
							guid.Data1, guid.Data2, guid.Data3,
							guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
							guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7]);

						if (wcscmp(currentGUID, strDeviceName) == 0)
						{
							hr = pNC->Rename(NPCAP_LOOPBACK_INTERFACE_NAME);
							bFound = TRUE;
							if (hr != S_OK)
							{
								wprintf(L"failed to create rename NPCAP_LOOPBACK_INTERFACE_NAME\r\n");
							}
						}

						pNC->Release();
					}
				}
				VariantClear(&v);
			}
			pEV->Release();
		}
		pNSECC->Release();
	}

	return bFound;
}

BOOL RenameLoopbackNetwork(wchar_t strDeviceName[])
{
	BOOL bResult = FALSE;
/*	CoInitialize (NULL);*/

	// init security to enum RAS connections
	CoInitializeSecurity (NULL, -1, NULL, NULL,
		RPC_C_AUTHN_LEVEL_PKT,
		RPC_C_IMP_LEVEL_IMPERSONATE,
		NULL, EOAC_NONE, NULL);

	INetSharingManager * pNSM = NULL;
	HRESULT hr = ::CoCreateInstance (__uuidof(NetSharingManager),
		NULL,
		CLSCTX_ALL,
		__uuidof(INetSharingManager),
		(void**)&pNSM);
	if (!pNSM)
	{
		wprintf (L"failed to create NetSharingManager object\r\n");
		return bResult;
	}
	else {

		// add a port mapping to every shared or firewalled connection.
		bResult = DoTheWork(pNSM, strDeviceName);

		pNSM->Release();
	}

/*	CoUninitialize ();*/

	return bResult;
}

What is similar .exe file in windows SDK like adb.exe in android SDK ?

$
0
0

Hello, I have used adb.exe in android SDK and commands like ' adb devices' to list the devices connected to the computer. Which is the similar .exe in Windows SDK ? Or is there any other command to find the devices connected to the computer ? 

http://www.androidcentral.com/android-201-10-basic-terminal-commands-you-should-know

Above link shows you commands used in android adb.exe. 

I apologize if the question is out of topic of this forum. 

[DX] Roadmap to DX12 development?

$
0
0

Hi,

I need to do some planning for my development activities. I do DirectX programming, mainly for the Oculus Rift, and want to migrate my code to DX12 as soon as possible. Certainly there were some tests possible with Windows 10 insider program and Windows 10 SDK and VisualStudio 2015. But for serious DX12 programming we need to have final documentation with examples.

With VisualStudio 2015 release in a matter of days and Windows 10 release in less than 2 weeks there should be a release date for finalized DirectX 12 part of Windows 10 SDK. Can we have a date, please? That would really be helpful!

Thanks


Windows Form User control Textbox field no accepting input.

$
0
0
I currently have an MFC dialog that is hosting a User control that I have created in VB.net. Everything works as expected (ie. ComboBoxes, ListView, etc..). When I select a Textbox that is hosted in this control no input gets accepted. I am unsure why this would occur. Any help would be appreciated.

FindExecutable() API doesn't work for the extension ".htm"

$
0
0

Dear All,

On Windows 10 Insider Preview (Build 10074 /Japanese Edition), FindExecutable() API doesn't work for the existing ".htm" extension file.

FindExecutable() API returns the code, 31 (No Association).

e.g.) ret = FindExecutable("full-path-to.htm", "", szResult);

Will this API work on Windows 10 release edition...?

Thank you.



Edit the include EXE file in the application folder.

$
0
0

Hi All,

I have developed an WPF application. Included the .APK file to the Application files by marking the file properties to "Copy if newer" and build action is "Content" in the VS 2010. I have installed the Wpf .exe in the System. Now the issue is when i replace the updated .APK file in the application files, its not updating the latest .APK file in the exe. How to update the .APK file in the exe for every time. Any help would be appreciable!!

Some help regarding ESENT db

$
0
0

I am trying to create a ESENT db and perform the basic crud operations.

This is how I create the DB -
Initialize(instanceName, databaseWorkingDirectory, fileName)
{
    JET_ERR error;
 
    error = JetCreateInstance(&m_jetInstance, instanceName);

    // configure ESE DB system parameters
    if (error == JET_errSuccess)
    {
        error = JetSetSystemParameter(&m_jetInstance, JET_sesidNil, JET_paramCircularLog, 1, NULL);
    }

    // the folder that will hold the transactions
    if (error == JET_errSuccess)
    {
        error = JetSetSystemParameter(&m_jetInstance, JET_sesidNil, JET_paramSystemPath, 0, databaseWorkingDirectory);
    }

    if (error == JET_errSuccess)
    {
        error = JetSetSystemParameter(&m_jetInstance, JET_sesidNil, JET_paramTempPath, 0, databaseWorkingDirectory);
    }

    if (error == JET_errSuccess)
    {
        error = JetSetSystemParameter(&m_jetInstance, JET_sesidNil, JET_paramLogFilePath, 0, databaseWorkingDirectory);
    }

    if (error == JET_errSuccess)
    {
        error = JetSetSystemParameter(&m_jetInstance, JET_sesidNil, JET_paramCreatePathIfNotExist, 1, NULL);
    }

    // Init the instance
    if (error == JET_errSuccess)
    {
        error = JetInit(&m_jetInstance);
    }

    // Begin Session
    if (error == JET_errSuccess)
    {
        error = JetBeginSession(m_jetInstance, &m_jetSessionId, 0, 0);
    }

    CHAR databaseFilePath[MAX_PATH] = { 0 };

    hr = StringCchPrintfA(databaseFilePath, ARRAYSIZE(databaseFilePath), "%s\\%s", databaseWorkingDirectory, fileName);

    if (error == JET_errSuccess)
    {
        // check if the db is present by attaching
        error = JetAttachDatabase(m_jetSessionId, databaseFilePath, 0);

        if (error == JET_errObjectNotFound || error == JET_errFileNotFound)
        {
            hr = JetCreateDatabase(m_jetSessionId, databaseFilePath, NULL, &m_jetDataBaseId, 0); // create db                      
        }
        else
        {
            hr = JetOpenDatabase(m_jetSessionId, databaseFilePath, NULL, &m_jetDataBaseId, 0); // open db           
        }
    }

    JET_COLUMNCREATE_W table[NUMBER_OF_COLUMNS] = { 0 };

    // Create Column
    CreateJetColumns(table, NUMBER_OF_COLUMNS);

    // Create Index
    JET_INDEXCREATE_W index = { 0 };
    index.cbStruct = sizeof(JET_INDEXCREATE_W);
    index.szIndexName = PK_INDEX;
    WCHAR indexString[] = L"+Key\0";
    index.szKey = indexString;
    index.cbKey = ARRAYSIZE(indexString) * sizeof(WCHAR);
    index.grbit = JET_bitIndexPrimary;

    // Prepare Table
    JET_TABLECREATE_W tableStructure = { 0 };
    tableStructure.cbStruct = sizeof(tableStructure);
    tableStructure.szTableName = TABLE;
    tableStructure.rgcolumncreate = table;
    tableStructure.cColumns = NUMBER_OF_COLUMNS;
    tableStructure.cIndexes = 1;     // hard coded to 1 index for now.
    tableStructure.rgindexcreate = &index;   

    // Open the table
    error = JetOpenTableW(m_jetSessionId, m_jetDataBaseId, TABLE, NULL, 0, JET_bitTableUpdatable, &m_jetTableId);

    // Table not present, so create the table
    if (error == JET_errObjectNotFound)
    {
        error = JetCreateTableColumnIndexW(m_jetSessionId, m_jetDataBaseId, &tableStructure);

        if (error == JET_errObjectNotFound)
        {
            error = JetOpenTableW(m_jetSessionId, m_jetDataBaseId, TABLE, NULL, 0, JET_bitTableUpdatable, &m_jetTableId);
        }
    }
}

Now, I am inserting data into the columns like this -

InsertData()
{
    WCHAR *columnValue[NUMBER_OF_COLUMNS] = { key, title, shortDescription, longDescription, additionalHelpLink, defaultValue, lastUpdatedDate, lastAccessedDate, wcharOffline }; // input values

    JET_SETCOLUMN setColumn[NUMBER_OF_COLUMNS] = { 0 };

    JET_ERR error;

    error = SetJetColumnValues(setColumn, NUMBER_OF_COLUMNS, columnValue);          

    if (SUCCEEDED(hr))
    {
        error = JetBeginTransaction(m_jetSessionId);
    }   

    if (SUCCEEDED(hr))
    {
        error = JetPrepareUpdate(m_jetSessionId, m_jetTableId, updateFlag);
    }

    if (SUCCEEDED(hr))
    {
        error = JetSetColumns(m_jetSessionId, m_jetTableId, setColumn, NUMBER_OF_COLUMNS);
    }

    if (SUCCEEDED(hr))
    {
        error = JetUpdate(m_jetSessionId, m_jetTableId, nullptr, 0, nullptr);
    }

    if (SUCCEEDED(hr))
    {
        error = JetCommitTransaction(m_jetSessionId, 0);
    }
}


When I am trying to see the first column value or seek to a particular value, it's not working for me. Can any of you let me know if I am doing something wrong here? When looking into the tempLog files that Jet creates I can see those records.

Font not rendering zero width characters properly in Windows 7

$
0
0
I have a font with two diacritical markings that are zero width. Under previous OS's they display properly over the entered character. In Windows 7 they appear as their own character with a character width equal to the glyph so the result is the diacritic is side by side the second character. I see the same error when using this font in WordPad. Are there any known problems with rendering a zero width characters in Windows 7?

C++ How to create and display a transparent icon on window's frame / border

$
0
0
I set the hIcon member of WNDCLASSEX structure to the return value ofCreateIcon call. Then I pass the address of WNDCLASSEX structure toRegisterClassEx call. The functions succeed (there are no errors), because I set the other members ofWNDCLASSEX structure properly before RegisterClassEx call. Then I callCreateWindowEx function by using the new registered class and then I show the new window by calling theShowWindow function with SW_SHOW. The window is visible and I can see the icon that I have just created with CreateIcon on the left top frame of the window small. The problem is that the background color of the icon is black and I can see that on the displayed icon on frame. I don't want to see the background color of the icon, but just the icon itself. I surf in the whole internet, but I didn't find the solution to my problem, so I post this question. Please answer my question. Maybe you can help me.

CryptAcquireContext intermittently hangs in my Smart Card Credential Provider

$
0
0

I enumerate containers on the smart card using CryptAcquireContext, with the sc reader as the container and the provider name. Sometimes the call hangs, and on occasion, if I remove the smart card, the call returns. The crypt call is being made in the same thread as my implementation of the ICredentialProvider::SetUsageScenario. Do I need to run this in another thread?


Joseph J Eremita


How to Lock Folder In windows

$
0
0

Respected Sir / Madam,

i am shivam ribadiya student of computer science & engineering in final year at in Gujarat, India

I do project on Bluetooth Technology ,

which is security protocol using Bluetooth on windows platform,let me give over view about this, our project in python,android platform, In this thing when we store our sensitive data in windows folder so to secure it using Bluetooth technology. The working thing is that when our Bluetooth device or our laptop or also PC disconnect or go out of range from Bluetooth when in data which is sensitive in folder it got lock automatically in Laptop or PC and generating notification both side in phone and laptop or PC that device is dis connect. That is working prototype of our project but problem is that me and my team member can't able to do lock folder in windows.

so i am humbly  requesting to you provide some information or help to do this thing in this problem.


 

Upgrade V1 CredentialProvider to V2 CredentialProvider

$
0
0

Hi!  I have a working V1 CredentialProvider that I am trying to upgrade to a V2 CredentialProvider.  I have V2 CredentialProvider sample code that compiles just fine in VS2013, but when copy the appropriate changes to my V1 CredentialProvider, I end up with an unresolved symbol:

Error    58    error LNK2001: unresolved external symbol Identity_LocalUserProvider

Seems to be because of this line in CSampleCredential.cpp:

_fIsLocalUser = (guidProvider == Identity_LocalUserProvider);

My platform toolset is Visual Studio 2013, and I'm linking against the same libraries as listed in the sample credential provider (they don't appear to have changed between V1 and V2 either.)  I have the Windows 8.1 SDK installed and external dependencies all appear to point to the right paths.  Previously the solution was a V1 credential provider with VS2008 platform tool set (running under VS2013) with Windows 7 SDK.  I've tried cleaning / rebuilding.  Driving me crazy!

Record Mouse and keyboard in host application

$
0
0

Hey guys

I have been working on a mouse recording and playback application and it works great, but only if I use an application external to my host windows forms application. The moment I try to click on one of the buttons in my local or host application (the one I am developing) the mouse events just wont fire.

I have been looking at posts all day long and most of them talk about global Hooks, which is supposed to be for all external applications on the desktop, but I am looking for application specific hooks. Here is the core part of my script where I do the actual assigning of the Hook Delegate

public void Start()
        {
            if (!_isStarted && _hookType != 0)
            {
                _hookCallback = new HookProc(HookCallbackProcedure);
                //_handleToHook = SetWindowsHookEx(_hookType, _hookCallback, (IntPtr)0, Thread.CurrentThread.ManagedThreadId);
               _handleToHook = SetWindowsHookEx(_hookType, _hookCallback, Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]), 0);

                if (_handleToHook != 0)
                {
                    _isStarted = true;
                }
            }
        }

This seems to work fine. I have tried to send the current thread id into the last parameter of SetWindowsHookEx, but then it wont record any activities. Here is where I try to call the mouse event.

public static void MouseUp(MouseButton button)
        {
            mouse_event((int)MouseEventFlags.LEFTUP, 0, 0, 0, 0);
        }

and that is calling this part of code

DllImport("user32.dll")]
        static extern int ShowCursor(bool show);

        [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]

        static extern void mouse_event(int flags, int dX, int dY, int buttons, int adInfo);

        const int MOUSEEVENTF_MOVE = 0x1;
        const int MOUSEEVENTF_LEFTDOWN = 0x0002;
        const int MOUSEEVENTF_LEFTUP = 0x0004;
        const int MOUSEEVENTF_RIGHTDOWN = 0x8;
        const int MOUSEEVENTF_RIGHTUP = 0x10;
        const int MOUSEEVENTF_MIDDLEDOWN = 0x20;
        const int MOUSEEVENTF_MIDDLEUP = 0x40;
        const int MOUSEEVENTF_WHEEL = 0x800;
        const int MOUSEEVENTF_ABSOLUTE = 0x8000; 

Like I mentioned. This seems to work fine, but ONLY for windows outside my main application. I tried to only give the core pieces of script, hope this helps and thanks so much for any help.


Thai Language - text rendering issue

$
0
0

Hi,

I've these scenarios. On a fresh stand alone Thai OS, my application (Win32) is failing to show any text (I've it translated for thai but thai text is not getting displayed in the UI). Its all empty

whereas the same application works perfect when user installed Thai language pack on top of English OS to perform testing. Thai text was properly rendered.

I don't understand on what changes between a standalone and a language pack installed OS? we've also properly set our locale to point to Thai. Despite we're seeing this issue.

Can someone please help on this?

Writing text on screen hDC=GetDC(hwnd) and SetBkMode(hDC,TRANSPARENT) do not work together

$
0
0

Hi,
I write a text on screen, and use

    hDC = GetDC(hwnd) ;
//  hDC = GetDC(NULL);

    SetBkMode(hDC,TRANSPARENT)
    DrawText(...);


I get text showing with the background color present, ie; not transparent 

I developed this with Visual Studio 8, and it worked fine then.

Now, I have Visual Studio 13, and I have this problem

Do you think something happened in Visual Studio 13?

I use Windows7 platform


The essence of my code is below

I tried both GetDC(hwnd) and hDC = GetDC(NULL); and result is the same.

    hDC = GetDC(hwnd) ;
 // hDC = GetDC(NULL);

     SetTextColor(hDC, crColor[4]);  //6]) ;
     SetBkMode(hDC, TRANSPARENT);

    ......... fill the logfont structure ........

    GetObject (hFont, sizeof (LOGFONT), &lf) ;

    SelectObject (hDC, CreateFontIndirect(&lf)) ;

    SetRect(&rect,370,393,369,393);
    DrawText(hDC,txtstr,-1,&rect,DT_EXPANDTABS | DT_NOCLIP | DT_NOPREFIX);

    DeleteObject (SelectObject (hDC, GetStockObject (SYSTEM_FONT))) ;

       if(hDC) ReleaseDC(hwnd, hDC);
 //    if(hDC) ReleaseDC(NULL, hDC);


I had the similar problem in different occasion when I use

   hdc = GetDC(Wnd);
// hdc = GetDC(NULL);
   SetROP2(hdc, R2_NOT);      
   MoveToEx(hdc,x1,y1+i,NULL);
   LineTo(hdc, x2, y2 + i);

It worked well in Visual Studio 8 but does not work correctly in Visual Studio 13.


I thank you in advance,

ChangChiTheGraphics

chang Chi


chang Chi

Viewing all 6180 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>