Click here to Skip to main content
15,903,030 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: registry api Pin
YaronNir17-Jul-03 4:20
YaronNir17-Jul-03 4:20 
GeneralRe: registry api Pin
Iain Clarke, Warrior Programmer17-Jul-03 4:38
Iain Clarke, Warrior Programmer17-Jul-03 4:38 
GeneralRe: registry api Pin
YaronNir17-Jul-03 4:54
YaronNir17-Jul-03 4:54 
GeneralRadio Button groups Pin
act_x16-Jul-03 8:49
act_x16-Jul-03 8:49 
GeneralRe: Radio Button groups Pin
John R. Shaw16-Jul-03 9:17
John R. Shaw16-Jul-03 9:17 
GeneralRe: Radio Button groups Pin
act_x16-Jul-03 10:43
act_x16-Jul-03 10:43 
GeneralRe: Radio Button groups Pin
John R. Shaw16-Jul-03 11:16
John R. Shaw16-Jul-03 11:16 
GeneralRe: SHBrowseForFolder works only one time when connecting to SQL server in between when using a manifest file Pin
Jens Doose16-Jul-03 8:18
Jens Doose16-Jul-03 8:18 
Hi all,

I experienced a strange behaviour, maybe one of you knows something
about it.

I have a little application that call SHBrowseForFolder, after that it
connects to an SQL server via SQLDriverConnect. After some work it
releases every allocated ODBC handle.
Any subsequent call to SHBrowseForFolder will display an empty dialog,
not even the controls are drawn.
This happens only if there is a manifest file for this application to
use the new common controls.

I included the source code as a sample a little bit more down,
if you would like the complete Devstudio workspace, just email me.

I would be happy if any of you knows something about this,

thanks in advance,


Jens



Source code:
-----------------

#ifndef BIF_NEWDIALOGSTYLE
#define BIF_NEWDIALOGSTYLE 0x0040
#define BIF_USENEWUI (BIF_NEWDIALOGSTYLE | BIF_EDITBOX)
#endif

void Go()
{
// *** Doesn't help...
// ::CoInitialize( 0 );
BROWSEINFO bi;
ZeroMemory( &bi, sizeof( bi ) );

bi.ulFlags = BIF_NEWDIALOGSTYLE | BIF_RETURNONLYFSDIRS;

SHBrowseForFolder( &bi );

SQLHENV env = NULL;
SQLRETURN sqlRet = SQLAllocEnv( &env );

SQLHDBC conn = NULL;
sqlRet = SQLAllocConnect( env, &conn );

SQLCHAR szOut[ 2048 ] = {0};

SQLCHAR sqlConn[ 1024 ] = "DRIVER={SQL Server};SERVER=(local)";
// SQLCHAR sqlConn[ 1024 ] = "DRIVER={Microsoft Text Driver (*.txt;
*.csv)};DBQ=test\\";

SWORD len = 0;
sqlRet = SQLDriverConnect( conn,
NULL,
sqlConn,
SQL_NTS,
szOut,
sizeof( szOut ),
&len,
SQL_DRIVER_COMPLETE_REQUIRED );

if ( ( SQL_SUCCESS != sqlRet )
&& ( SQL_SUCCESS_WITH_INFO != sqlRet ) )
{
SWORD nMessageLen = 0;

UCHAR szMessage[ SQL_MAX_MESSAGE_LENGTH ] = {0};
SDWORD dwNativeErrorCode = 0;
UCHAR szErrorState[ SQL_SQLSTATE_SIZE + 1 ] = {0};

sqlRet = SQLError( env,
conn,
SQL_NULL_HSTMT,
szErrorState,
&dwNativeErrorCode,
szMessage,
SQL_MAX_MESSAGE_LENGTH - 1,
&nMessageLen );

::MessageBox( NULL,
(CHAR*)szMessage,
(CHAR*)szErrorState,
MB_OK );
}

sqlRet = SQLDisconnect( conn );

sqlRet = SQLFreeHandle( SQL_HANDLE_DBC, conn );

sqlRet = SQLFreeHandle( SQL_HANDLE_ENV, env );

// *** Doesn't help...
// ::CoInitialize( 0 );
ZeroMemory( &bi, sizeof( bi ) );
bi.ulFlags = BIF_NEWDIALOGSTYLE | BIF_RETURNONLYFSDIRS;
SHBrowseForFolder( &bi );
}


GeneralRe: SHBrowseForFolder works only one time when connecting to SQL server in between when using a manifest file Pin
David Crow16-Jul-03 9:42
David Crow16-Jul-03 9:42 
GeneralRe: SHBrowseForFolder works only one time when connecting to SQL server in between when using a manifest file Pin
Jens Doose16-Jul-03 20:21
Jens Doose16-Jul-03 20:21 
GeneralRe: SHBrowseForFolder works only one time when connecting to SQL server in between when using a manifest file Pin
David Crow17-Jul-03 5:49
David Crow17-Jul-03 5:49 
GeneralRe: SHBrowseForFolder works only one time when connecting to SQL server in between when using a manifest file Pin
Jens Doose17-Jul-03 19:34
Jens Doose17-Jul-03 19:34 
GeneralRe: SHBrowseForFolder works only one time when connecting to SQL server in between when using a manifest file Pin
David Crow18-Jul-03 5:54
David Crow18-Jul-03 5:54 
GeneralWM_CONTEXTMENU Pin
pranavamhari16-Jul-03 7:34
pranavamhari16-Jul-03 7:34 
QuestionMFC - How to print ? Pin
Exim16-Jul-03 6:55
Exim16-Jul-03 6:55 
GeneralHeapValidate question Pin
Anonymous16-Jul-03 6:27
Anonymous16-Jul-03 6:27 
GeneralRe: HeapValidate question Pin
Mike Dimmick16-Jul-03 6:48
Mike Dimmick16-Jul-03 6:48 
GeneralRe: HeapValidate question Pin
Anonymous16-Jul-03 7:09
Anonymous16-Jul-03 7:09 
GeneralRe: HeapValidate question Pin
Peter Weyzen16-Jul-03 7:52
Peter Weyzen16-Jul-03 7:52 
GeneralRe: HeapValidate question Pin
Mike Dimmick16-Jul-03 22:28
Mike Dimmick16-Jul-03 22:28 
QuestionGetting the same value everytime?? Pin
johnstonsk16-Jul-03 6:01
johnstonsk16-Jul-03 6:01 
AnswerRe: Getting the same value everytime?? Pin
David Crow16-Jul-03 7:02
David Crow16-Jul-03 7:02 
AnswerRe: Getting the same value everytime?? Pin
Peter Weyzen16-Jul-03 7:58
Peter Weyzen16-Jul-03 7:58 
AnswerRe: Getting the same value everytime?? Pin
Ryan Binns16-Jul-03 17:33
Ryan Binns16-Jul-03 17:33 
GeneralEDID data, display driver Pin
oliver.hu16-Jul-03 5:19
oliver.hu16-Jul-03 5:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.