|
Hi All,
I have a notepad like application. I want to avoid from taking snapshots of my application using printscreen like facility. Is there any way?
|
|
|
|
|
I don't know the correct answer,
but i don't think so, because the PrintScreen-Key will be handled in each way in windows itselfs,
so you can't suppress this key in your app and windows never remarks it.
Because you can "steal" any picture in a browser which is protected via different methods over
the printscreen...
If the disabling of the PrintScreen-Key works, all browsers would use this method to protect
the pics into the browser
But propably there is a specific technique to do that, but i never heared about it.
Good luck
|
|
|
|
|
Im not sure about, but I think that hooking the message of "print screen" and doing nothing / something different while the application is active could work. But its pretty hard work.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Injecting a hook into windows? ouch
I never want to try this LOL, that's to hard for me
I even don't know in which DLL to hook in
But it's a solution, right
|
|
|
|
|
Neither do I, but it doesn't mean that is impossible
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hi,
Hope somebody can help me.
I want to access database in my program but I don't know how to make a connection. I'm using MySQL and VC++ 2003 MFC.
If you have an idea or a link related please let me know.
It would be a big help.
Thank you.
|
|
|
|
|
Did you see Database section on the codeproject ?
|
|
|
|
|
|
#include "mysql.h"
#include "winsock.h"
#pragma comment(lib,"libmySQL.lib")
MYSQL mysql;
mysql_init (&mysql);
if(!mysql_real_connect(&mysql,"localhost","root",NULL,"mydb",3306,NULL,0))
{
AfxMessageBox("database connection error");
return FALSE;
}
|
|
|
|
|
|
i created an application in Mfc Dialog and i want to increase the dialog size as per the screen size programatically so that the controls in the dialog does not change its positions.
Thanks in Advance
||SnAkeBed||
|
|
|
|
|
You can use of MoceWindow on the WM_SIZE .
|
|
|
|
|
Actually is MoveWindow :P (I know, typing error, but better to be sure the people gets the correct answer )
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
He needs to an if before using of it on the wm_size .
|
|
|
|
|
SnaKeBeD wrote: i created an application in Mfc Dialog and i want to increase the dialog size as per the screen size programatically so that the controls in the dialog does not change its positions.
SetWindowPos is another api, apart from MoveWindow as quoted by Mr. Hamid (nice one)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
My MFC program has many line of code that using relative path like
("./data/test.jpg")
I alway reset the current directory after using CFileDialog so that
the ralative path - code in my program alway work ,
by doing something like this.
<br />
char currentDir[MAX_PATH];<br />
GetCurrentDirectory(currentDir);<br />
---- browse for file ------<br />
SetCurrentDirectory(currentDir);<br />
I has recently intregrated WinHelp in my program.
The problem is when user using WinHelp print function and selected those virtual printer like (Microsoft document writer) and browse for save path ,
My application's
current directory also change and since WinHelp doesn't block my application
(It a modeless dialog or something) I cant use the reset current directory method above.
Since my time is very limit , The only solution I came up here is
-------1.save the current directory into some static variable immediately after launching program
-------2.before calling and file access function that may invole relative path,
call SetCurrentDirectory(); with the saved directory
Will this solution alway work ?
since converting any relative part to absolute part is not an option now (some data are store in database as relative path)
I have to apologize for my very poor english and thank for answer in advance.
Xanagan
|
|
|
|
|
To ensure that you are in your APP folder:
char FileName[MAX_PATH];
GetModuleFileName(NULL, FileName, MAX_PATH);
CString m_szPath = FileName;
m_szPath = m_szPath.Left(m_szPath.ReverseFind('\\'));
Afterwards you can this to open/create files in the folder or whatever you need.
m_szPath += "MyDll.dll";
HINSTANCE hInst = LoadLibrary (m_szPath);
or...
m_szPath += "AnyDataFile.ext";
CFile f (m_szPath, CFile::modeCreate | CFile::modeWrite);
And with this you don't have to worry about the CurrentDirectory modified by CFileDialog, actually I use both options, but for different things.
Hope it helps
EDIT: Ups, I missed your "since absolute path dont desired", your idea about saving the current directory in a variable and set it back after modifying will work perfectly. But watch out here you save it. You may overwrite it without pretending it.
-- modified at 3:11 Tuesday 6th November, 2007
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
This seem more safe than calling SetCurrentDirectory before every file operation.
but the amount of code I need to modified is too much (I have both those Hard-code and some that query relative path-string from file/database)
So I may have to go with my first solution
(calling SetCurrentDirectory(applicationPath) before any set of file operation / in the head of function where I am sure that the current directory will not change).
will my solution has any side effect in the long term ?
Thank for your answer
|
|
|
|
|
With this code you dont need to call it everywhere. You can call it just once in your OnInitialUpdate, OnInitDialog or wherever class/module you need it, save it in a member variable and just replace the old vars names with the new one.
I mean, with this code you can save the m_szAppPath and use it as basis for all the other places, m_szFileName = m_szAppPath + "WhateverYouWant.ext";
And you can make it automatically with search and replace. I have used it a lot in my project :P
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Yes it will work. Just assign the directory to a global variable and use SetDirectory after lines that may change the current directory the application is pointing to.
|
|
|
|
|
|
Hello everyone,
I have two DLLs and two related import libraries, and currently I want to merge them into one DLL and on import libraries.
Are there any smarter ways to quick merge them? Any tools in Visual Studio 2005? I want to keep the exported function in both DLLs and import libraries.
thanks in advance,
George
|
|
|
|
|
George_George wrote: I have two DLLs and two related import libraries, and currently I want to merge them into one DLL and on import libraries.
If they are two Win32/MFC based dll, you just have to include all cpp and h file, where there defination and decalration of exported function into one new project, also check for there dependency!
AFAIK there is no such tool for merging dll (Might be someother person have experienced in it), you have to manually collect files into one project!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thanks ThatsAlok,
Seems that there is no time-saving tool and I have to do such things manually.
regards,
George
|
|
|
|
|
George_George wrote: Thanks ThatsAlok,
you are welcome!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|